Sorting a Matrix by columns
24 次查看(过去 30 天)
显示 更早的评论
I have a 12 x 12 matrix and I have used the command 'sortrows' to sort the matrix in ascending order of rows. How can I do the same but sorting by columns (i.e. ascending order of columns) instead of rows?
0 个评论
采纳的回答
Cris LaPierre
2021-3-21
I would suggest transposing your matrix, sortrows, then transpose the result.
A=rand(5)
B=sortrows(A')'
更多回答(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!