How to sort one column of a matrix

34 Ansichten (letzte 30 Tage)
Zeynab Mousavikhamene
Zeynab Mousavikhamene am 13 Aug. 2019
I have a matrix that has 500 rows and 5 columns. I want to sort the matrix based on the 3 rd column. I mean rearrange the matrix based on the 3rd column descending.

Akzeptierte Antwort

Stephan
Stephan am 13 Aug. 2019
Bearbeitet: Stephan am 13 Aug. 2019
B = sortrows(A,-3)
  3 Kommentare
Stephan
Stephan am 13 Aug. 2019
Bearbeitet: Stephan am 13 Aug. 2019
note that i used
sortrows
instead of
sort
Zeynab Mousavikhamene
Zeynab Mousavikhamene am 13 Aug. 2019
Thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

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

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by