フィルターのクリア

I want to convert the numbers in the matrix as the letter .

2 ビュー (過去 30 日間)
Sakunrat Jaejaima
Sakunrat Jaejaima 2015 年 7 月 1 日
コメント済み: annmaria 2015 年 7 月 13 日
Hello . I do code but it runs off a single character , I want it to run all out. What to do?
B=input('Enter martrix:');
switch B(1,1)
case{1}
disp('A');
case{2}
disp('B');
case{3}
disp('C');
case{4}
disp('D');
case{5}
disp('E');
case{6}
disp('F');
case{7}
disp('G');
case{8}
disp('H');
case{9}
disp('I');
case{10}
disp('J');
case{11}
disp('K');
case{12}
disp('L');
case{13}
disp('M');
case{14}
disp('N');
case{15}
disp('O');
case{16}
disp('P');
case{17}
disp('Q');
case{18}
disp('R');
case{19}
disp('S');
case{20}
disp('T');
case{21}
disp('U');
case{22}
disp('V');
case{23}
disp('W');
case{24}
disp('X');
case{25}
disp('Y');
case{26}
disp('Z');
case{27}
disp('.');
case{28}
disp('?');
otherwise
disp(' ');
end

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 7 月 1 日
b=input('enter a number');
str=['A':'Z' '.?']
if ismember(b,1:28)
out=str(b)
disp(out)
else
disp(' ')
end
  2 件のコメント
Sakunrat Jaejaima
Sakunrat Jaejaima 2015 年 7 月 2 日
It the number 0 it error.
Azzi Abdelmalek
Azzi Abdelmalek 2015 年 7 月 13 日
What error?

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

その他の回答 (1 件)

Stephen23
Stephen23 2015 年 7 月 1 日
編集済み: Stephen23 2015 年 7 月 13 日
To perform this for all elements of the input array you should learn how to write vectorized code, which is much neater, faster and less buggy, and also learn how indexing works.
B = input('Enter a matrix: ');
B(B<1 | B>29) = 29;
V = ['A':'Z','.? '];
V(B)
When this code is run it produces this in the command line:
Enter a matrix: [1,2,0,3,27;4,28,5,29,6]
ans =
AB C.
D?E F
  3 件のコメント
Stephen23
Stephen23 2015 年 7 月 13 日
My pleasure. You can also accept answers that best help to resolve your question.
annmaria
annmaria 2015 年 7 月 13 日
If i have two folders with letters .First One have different fond and orientation. i want to match the letters with the other folder and display the letters in the second folder. Is it possible. Can anyone please help me.

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

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by