How can i convert number to letter?
Afficher commentaires plus anciens
I have a long data sets which is like [1;4;12;3;15;2;.....;16]. I want to replace number to letter. Like 1=N 2=NN 3=NNE 4=SS 5=WSW.... How can i manage this in matlab;
Thank you already,
Cagri
Réponses (1)
Jos (10584)
le 18 Fév 2015
Take a look at cell arraysof strings. Use the number directly as indices into a cell array, or convert using some scheme (like 100=1, 234=2, -12=3) first.
num = [1 3 5 4 3 2 2 1] % num van be used as direct indices
words = {'A','B','CC','DDDD','EE'} % list of words
NumInWords = words(num) % output cell array
Catégories
En savoir plus sur Cell Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!