Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
Sakunrat Jaejaima
Sakunrat Jaejaima le 1 Juil 2015
Commenté : annmaria le 13 Juil 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

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 1 Juil 2015
b=input('enter a number');
str=['A':'Z' '.?']
if ismember(b,1:28)
out=str(b)
disp(out)
else
disp(' ')
end
  2 commentaires
Sakunrat Jaejaima
Sakunrat Jaejaima le 2 Juil 2015
It the number 0 it error.
Azzi Abdelmalek
Azzi Abdelmalek le 13 Juil 2015
What error?

Connectez-vous pour commenter.

Plus de réponses (1)

Stephen23
Stephen23 le 1 Juil 2015
Modifié(e) : Stephen23 le 13 Juil 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 commentaires
Stephen23
Stephen23 le 13 Juil 2015
My pleasure. You can also accept answers that best help to resolve your question.
annmaria
annmaria le 13 Juil 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by