Reordering variables in a table array

1 Ansicht (letzte 30 Tage)
Omer Yasin Birey
Omer Yasin Birey am 25 Dez. 2018
Kommentiert: madhan ravi am 25 Dez. 2018
Let's say I have the table below. I want to reorder them by their ages. I tried to use
TSort.Age = sort(TSort.Age)
but it doesn't work because it only sorts the numbers and the corresponding elements remain at the same place.
TSort =
5×6 table
LastName Age Smoker Height Weight BloodPressure
_________ ___ ______ ______ ______ _____________
'Sanchez' 38 true 71 176 124 93
'Johnson' 43 false 69 163 109 77
'Li' 41 true 64 131 125 83
'Diaz' 40 false 67 133 117 75
'Brown' 49 true 64 119 122 80

Akzeptierte Antwort

madhan ravi
madhan ravi am 25 Dez. 2018
sortrows() %?
  2 Kommentare
Omer Yasin Birey
Omer Yasin Birey am 25 Dez. 2018
Bearbeitet: Omer Yasin Birey am 25 Dez. 2018
Oh well, I wasn't aware of this command. Thank you Madhan!
madhan ravi
madhan ravi am 25 Dez. 2018
Anytime :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Tables 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