how to simplify multi- if statement
Mostrar comentarios más antiguos
I'm trying to do the following work, given a string of 'ABCDE' etc,
for each letter, it will be assigned with a unique number.
How would I do it without putting 26 if and else if statement in a simple way?
I'm thinking of two matrices. But it may not be on the right track. Can anyone help with this case? Thanx in advance!
1 comentario
Qian
el 6 de Dic. de 2012
Respuesta aceptada
Más respuestas (1)
Rick Rosson
el 6 de Dic. de 2012
aStr = 'ABCDE';
x = uint8(aStr) - 64;
1 comentario
Qian
el 6 de Dic. de 2012
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!