Sorting rows - case insensitive?
Ältere Kommentare anzeigen
I am trying to sort the following matrix in alphabetical order and sortrows(A) seems to do the trick, except for the fact that the word "Happy" doesn't get properly sorted. Is there a way to make sortrows case insensitive, or accomplish my objective with a different function that is flexible enough to accommodate an option for case insensitivity?
Thanks in advance.
A=[Happy the man and happy he alone]
1 Kommentar
Azzi Abdelmalek
am 13 Nov. 2014
Bearbeitet: Azzi Abdelmalek
am 13 Nov. 2014
Your question is not clear, and the variable A=[Happy the man and happy he alone] does not make sens, maybe
A='Happy the man and happy he alone'
Or
A={'Happy' 'the' 'man' 'and' 'happy' 'he' 'alone'}
Antworten (2)
Azzi Abdelmalek
am 13 Nov. 2014
Bearbeitet: Azzi Abdelmalek
am 13 Nov. 2014
A={'Happy' 'the' 'man' 'and' 'happy' 'he' 'alone'}
[~,idx]=sort(upper(A))
out=A(idx)
Guillaume
am 13 Nov. 2014
1 Stimme
Kategorien
Mehr zu Shifting and Sorting Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!