Sorting a fields alignment of a structure

2 ビュー (過去 30 日間)
FG
FG 2020 年 9 月 16 日
コメント済み: FG 2020 年 9 月 23 日
Hi all.. I want to sort a structure containing some fields according to '' My Will''.. I mean I wanna arrange it as I like it. For example my structure has names, amps and volts
Names are :
'Power Factor=0.85, PL=10000, FG=5000, Angle=0, Nt=1.mat'
'Power Factor=0.85, PL=10000, FG=5000, Angle=0, Nt=10.mat'
'Power Factor=0.85, PL=10000, FG=5000, Angle=0, Nt=2.mat'
'Power Factor=0.85, PL=10000, FG=5000, Angle=0, Nt=5.mat'
'Power Factor=0.85, PL=10000, FG=5000, Angle=10, Nt=1.mat'
.
.
.
I wanna sort them either to Nt, Angle or FG or Power Factor as I want to do.. How can I do this ?

回答 (1 件)

Mrunmayee Gaikwad
Mrunmayee Gaikwad 2020 年 9 月 22 日
The following blog explains how you can sort a structure array according to the field name:
The MATLAB code for functions ‘nestedSortStruct’ and ‘sortStruct’ mentioned in the blog can be found here:
  1 件のコメント
FG
FG 2020 年 9 月 23 日
Thank you..

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

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by