sort rows of a matrix based on their maximum value
4 次查看(过去 30 天)
显示 更早的评论
Hello,
Consider a 100x10 matrix.
Each 1x10 row has a maximum value.
How can I sort the rows of the matrix in ascending order based only on their maximum value?
Thank you very much.
Best,
Pavlos
0 个评论
采纳的回答
Jan
2013-9-11
A = rand(100, 10);
maxA = max(A, [], 2);
[dummy, index] = sort(maxA);
B = A(index, :);
1 个评论
更多回答(2 个)
另请参阅
类别
在 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!