Sorting a Matrix by columns
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
NotRiyad NotHosein
el 20 de Mzo. de 2021
Comentada: NotRiyad NotHosein
el 21 de Mzo. de 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 comentarios
Respuesta aceptada
Cris LaPierre
el 21 de Mzo. de 2021
I would suggest transposing your matrix, sortrows, then transpose the result.
A=rand(5)
B=sortrows(A')'
Más respuestas (0)
Ver también
Categorías
Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!