How can I turn a matrix into character text in MATLAB?
2 ビュー (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
回答 (2 件)
Guillaume
2017 年 11 月 21 日
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);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Multidimensional Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!