I'm wondering if anyone understands how to write a code such that each letter of the alphabet is given a corresponding number from 1-26, and 27 is a blank space... Basically, I have to decipher a matrix. I tried using something like this;
Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
numbers = [1,12,7,5,2;18,1,27,27,27]
letters = Alphabet(numbers)
The output should be ALGEBRA, but I get an error message.

1 件のコメント

Victoria McCauley
Victoria McCauley 2018 年 10 月 23 日
It seems to work is I only type one column at a time. So that may have been my problem

サインインしてコメントする。

 採用された回答

Rik
Rik 2018 年 10 月 23 日

0 投票

You forgot a space in your definition:
Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ ';
numbers = [1,12,7,5,2;18,1,27,27,27];
letters = Alphabet(numbers)

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

質問済み:

2018 年 10 月 23 日

回答済み:

Rik
2018 年 10 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by