sorting matrix in ascending order based on column 1 (and ascending order also for column 2)
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
JL
el 14 de Sept. de 2019
Editada: the cyclist
el 14 de Sept. de 2019
Hi all, is there a way to sort A in ascending order based on column 1, allowing its other columns to follow with it
A = [1 2 5
1 3 3
2 3 12
1 4 2];
results should be:
B = [1 2 5
1 3 3
1 4 2
2 3 12
];
0 comentarios
Respuesta aceptada
the cyclist
el 14 de Sept. de 2019
Editada: the cyclist
el 14 de Sept. de 2019
B = sortrows(A,1);
0 comentarios
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!