構造体配列の並び替え (降順)
57 ビュー (過去 30 日間)
古いコメントを表示

添付図のような構造体配列において、フィールドSに対して"降順"で並び替えをし、フィールドP1、P2、P3もそれに対応して行を並び替えたいです。
構造体配列の行を並び替える方法はありますでしょうか。
0 件のコメント
採用された回答
Akira Agata
2021 年 1 月 11 日
struct2table 関数でいったんテーブル型変数に変換して、sort 関数でソートしたうえで再び table2struct 関数で構造体配列に戻す、という方法ではいかがでしょうか?
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!