Sorting a Matrix by columns
20 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
NotRiyad NotHosein
am 20 Mär. 2021
Kommentiert: NotRiyad NotHosein
am 21 Mär. 2021
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 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 21 Mär. 2021
I would suggest transposing your matrix, sortrows, then transpose the result.
A=rand(5)
B=sortrows(A')'
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!