필터 지우기
필터 지우기

Sorting a fields alignment of a structure

조회 수: 4 (최근 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:

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by