How to sort a struct
182 ビュー (過去 30 日間)
古いコメントを表示
Is it possible to sort a struct? I want to sort the third column.
0 should be in the first row and the highest value at the end (last row). The other values are not important and should be the same ranking.
Thank you.
2 件のコメント
採用された回答
Mohammad Sami
2020 年 7 月 23 日
編集済み: Mohammad Sami
2020 年 7 月 23 日
You can try like this.
% a = somestruct;
[~,index] = sortrows([a.Var3].');
a = a(index);
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!