how to reverse "sort"
80 ビュー (過去 30 日間)
古いコメントを表示
For example we have a row like
m=[1 6 2 8 9] [Y,I] = sort(m)
then it gives you
Y =
1 2 6 8 9
I =
1 3 2 4 5
But I would like to sort them from big number to small
0 件のコメント
採用された回答
Joan Puig
2011 年 9 月 10 日
Hi,
There is an extra optional argument that will do that:
>> m=[1 6 2 8 9]; [Y,I] = sort(m,'descend')
Y =
9 8 6 2 1
I =
5 4 2 3 1
>>
1 件のコメント
その他の回答 (1 件)
Wayne King
2011 年 9 月 10 日
Hi, have you read the documentation for sort()?
m = [1 6 2 8 9];
[Y,I] = sort(m,'descend');
Wayne
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!