How to sort a table by one column

92 ビュー (過去 30 日間)
Sebastian Engelsgaard
Sebastian Engelsgaard 2021 年 1 月 28 日
コメント済み: David Ebert 2022 年 10 月 3 日
Hi,
I have a 3x2 table defined as:
Var1 Var2
__________________________ ______
{'data1'} 23.28
{'data2'} 2.56
{'data3'} 110.69
and I have tried to sort the rows by using:
sortedtable = sort(table.Var2,'descend')
However, it only returns the variable 'sortedtable' as:
Var2
______
110.69
23.28
2.56
and I would like to have the format as shown below in a UITable:
Var1 Var2
__________________________ ______
{'data3'} 110.69
{'data1'} 23.28
{'data2'} 2.56
app.UITable.Data= sortedtable
Can anyone help?

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 1 月 28 日
Try sortrows using this syntax
  1 件のコメント
David Ebert
David Ebert 2022 年 10 月 3 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by