How can i convert number to letter?
이전 댓글 표시
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
답변 (1개)
Jos (10584)
2015년 2월 18일
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
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!