Convert an array of letters into numbers
52 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I would like to convert an array of letters into numbers. Based on this code:
Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
numbers = [3,6,12,1,1,3]
letters = Alphabet(numbers)
I would like to make the reverse of this. I mean I want to find eg 'HELLO' to which numbers correspont based on the above code.
Respuestas (2)
Walter Roberson
el 30 de En. de 2021
Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
[~, HelloNumbers] = ismember('HELLO', Alphabet)
Map(Alphabet) = 1:length(Alphabet);
Map('HELLO')
5 comentarios
Stephen23
el 31 de En. de 2021
"Is there a way to set A equal to Á and À? I mean in order to not take into account accents?"
Yes, two approaches were given to you in answers to your earlier question (which you then deleted):
Walter Roberson
el 31 de En. de 2021
Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZÀÈÌÒÙÁÉÍÓÚÄËÏÖŸ';
Map(Alphabet(1:26)) = 1:26;
Map(Alphabet(27:end)) = Map('AEIOUAEIOUAEIOY');
Map('HÈLLÖ')
Ver también
Categorías
Más información sobre Data Type Conversion en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!