フィルターのクリア

Sort a Matrix based on a column

2 ビュー (過去 30 日間)
Kris zenitis
Kris zenitis 2011 年 12 月 9 日
コメント済み: Azzi Abdelmalek 2014 年 2 月 19 日
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???

採用された回答

Walter Roberson
Walter Roberson 2011 年 12 月 9 日
[lastvals, idx] = sort(A(:,end));
sortedA = A(idx,:);
  2 件のコメント
Walter Roberson
Walter Roberson 2011 年 12 月 9 日
Sorry I had the index order reversed. It is fixed in my Answer now.
Azzi Abdelmalek
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 ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by