Sorting rows - case insensitive?
18 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Azzi Abdelmalek
2014 年 11 月 13 日
編集済み: Azzi Abdelmalek
2014 年 11 月 13 日
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'}
回答 (2 件)
Azzi Abdelmalek
2014 年 11 月 13 日
編集済み: Azzi Abdelmalek
2014 年 11 月 13 日
A={'Happy' 'the' 'man' 'and' 'happy' 'he' 'alone'}
[~,idx]=sort(upper(A))
out=A(idx)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Shifting and Sorting Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!