sorting matrix in ascending order based on column 1 (and ascending order also for column 2)

2 ビュー (過去 30 日間)
Hi all, is there a way to sort A in ascending order based on column 1, allowing its other columns to follow with it
A = [1 2 5
1 3 3
2 3 12
1 4 2];
results should be:
B = [1 2 5
1 3 3
1 4 2
2 3 12
];

採用された回答

the cyclist
the cyclist 2019 年 9 月 14 日
編集済み: the cyclist 2019 年 9 月 14 日
Use the sortrows command.
B = sortrows(A,1);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by