I have a matrix something like this
1 1 ...
2 1 ...
3 1 ...
1 2 ...
2 2 ...
3 2 ...
1 3 ...
2 3 ...
3 3 ...
I would like to arrange rows according to the first column, but I would like to hold the order for equal values, so I would like the following output
1 1 ...
1 2 ...
1 3 ...
2 1 ...
2 2 ...
2 3 ...
3 1 ...
3 2 ...
3 3 ...

 Respuesta aceptada

Star Strider
Star Strider el 17 de Abr. de 2015

2 votos

Use the sortrows function, specifying column #1.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Preguntada:

el 17 de Abr. de 2015

Respondida:

el 17 de Abr. de 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by