Elements relation on a matrice? Basic

9 Ansichten (letzte 30 Tage)
Renato de Sá
Renato de Sá am 8 Feb. 2011
Hello,
Is it possible to relate elements on a matrice? For exemple:
A = [20 1; 180 2; 135 3; 80 4]
If I want to sort the elements from the first collumn without changing its second collumn corresponding, is it possible?
I want it to end like:
B = [20 1; 80 4; 135 3; 180 2]
Thanks

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 8 Feb. 2011
doc sortrows
for this case
sortrows(A,[1 2])

Weitere Antworten (0)

Kategorien

Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by