I want to convert the numbers in the matrix as the letter .
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sakunrat Jaejaima
il 1 Lug 2015
Commentato: annmaria
il 13 Lug 2015
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
0 Commenti
Risposta accettata
Azzi Abdelmalek
il 1 Lug 2015
b=input('enter a number');
str=['A':'Z' '.?']
if ismember(b,1:28)
out=str(b)
disp(out)
else
disp(' ')
end
2 Commenti
Più risposte (1)
Stephen23
il 1 Lug 2015
Modificato: Stephen23
il 13 Lug 2015
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 Commenti
Stephen23
il 13 Lug 2015
My pleasure. You can also accept answers that best help to resolve your question.
annmaria
il 13 Lug 2015
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.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!