Reordering variables in a table array

조회 수: 1 (최근 30일)
Omer Yasin Birey
Omer Yasin Birey 2018년 12월 25일
댓글: madhan ravi 2018년 12월 25일
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

채택된 답변

madhan ravi
madhan ravi 2018년 12월 25일
  댓글 수: 2
Omer Yasin Birey
Omer Yasin Birey 2018년 12월 25일
편집: Omer Yasin Birey 2018년 12월 25일
Oh well, I wasn't aware of this command. Thank you Madhan!
madhan ravi
madhan ravi 2018년 12월 25일
Anytime :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by