Effacer les filtres
Effacer les filtres

How to order matrix rows?

2 vues (au cours des 30 derniers jours)
Mr M.
Mr M. le 17 Avr 2015
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 ...

Réponse acceptée

Star Strider
Star Strider le 17 Avr 2015
Use the sortrows function, specifying column #1.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating 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!

Translated by