Sorting a Matrix by columns
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
NotRiyad NotHosein
le 20 Mar 2021
Commenté : NotRiyad NotHosein
le 21 Mar 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 commentaires
Réponse acceptée
Cris LaPierre
le 21 Mar 2021
I would suggest transposing your matrix, sortrows, then transpose the result.
A=rand(5)
B=sortrows(A')'
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!