Borrar filtros
Borrar filtros

How can I turn a matrix into character text in MATLAB?

2 visualizaciones (últimos 30 días)
B
B el 21 de Nov. de 2017
Respondida: Guillaume el 21 de Nov. de 2017
The matrix has the numbers 1-26 as the corresponding letters A-Z and 27 is a space. Is there anyway I can use MATLAB to make this conversion?

Respuestas (2)

M
M el 21 de Nov. de 2017

Guillaume
Guillaume el 21 de Nov. de 2017
One way:
lettervalues = randi(27, 1, 50)
actualletters = char(lettervalues + 'A' - 1);
actualletters(lettervalues == 27) = ' '
Another way:
lettervalues = randi(27, 1, 50)
lookuptable = ['A':'Z', ' '];
actualletters = lookuptable(lettervalues);

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by