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 Exchange에서 Programming에 대해 자세히 알아보기

질문:

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