필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
B
B 2017년 11월 21일
답변: Guillaume 2017년 11월 21일
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?

답변 (2개)

M
M 2017년 11월 21일

Guillaume
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);

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by