How can I shorten my code via loading a data chart? HELP!
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Reni Llupa
el 26 de Nov. de 2017
Respondida: Walter Roberson
el 26 de Nov. de 2017
I have a data chart with values (matrices of 0s and 1s) which represent braille. Each letter is a 2x3 matrix. My code converts strings of english letters to a matrix with the braille. How can I index the data chart instead of writing all the a-z out in my code? (aka make my code shorter). I will attach the data table with braille values. Thanks in advance.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/170170/image.png)
0 comentarios
Respuesta aceptada
Walter Roberson
el 26 de Nov. de 2017
[tf, letteridx] = ismember(lower(stg), ['a':'z']);
if ~all(tf)
warning('Ignoring unknown letters: %s', stg(~tf));
end
table_pos = letteridx(tf);
braille = reshape( [brailleTable(:, table_pos*2-1); brailleTable(:, table_pos*2)], 3, []);
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Distribution Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!