Sort a Matrix based on a column
2 ビュー (過去 30 日間)
古いコメントを表示
I want to sort a matrix. Actually I want to sort the last column and all the rest columns based on the last. Has anyone idea about this???
0 件のコメント
採用された回答
Walter Roberson
2011 年 12 月 9 日
[lastvals, idx] = sort(A(:,end));
sortedA = A(idx,:);
2 件のコメント
Azzi Abdelmalek
2014 年 2 月 19 日
[Kris zenitis commented]
I ve got a matrix 4000x9. When i tried your solution i got Index exceeds matrix dimensions.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!