groupStruct

버전 1.0.0.0 (2.67 KB) 작성자: Ivar Eskerud Smith
Group a struct-array by the nominal values for specified fields.
다운로드 수: 166
업데이트 날짜: 2012/5/29

라이선스 보기

Group a struct-array by the nominal values (which will be created) for the fields you specify. Returns a grouped struct, a cell-array containing the different groups, a cell-array with the nominal values that were used, a cell-array with the fields that were used, and a cell-array with the indexes from the original struct corresponding to the one used in the groups.
If you for instance have a struct-array with experimental data with different inclinations (PHI) and velocities (V) you can use the following example to group the experiments by the nominal values for the fields PHI and V:

%Create some artificial experimental data
s=struct;
s.PHI=0;
s.V=1.1;
s(end+1).PHI=1;
s(end).V=1.082;
s(end+1).PHI=0;
s(end).V=1.084;
s(end+1).PHI=1;
s(end).V=0.61;
s(end+1).PHI=1;
s(end).V=0.58;
s(end+1).PHI=0;
s(end).V=0.598;
s(end+1).PHI=0;
s(end).V=1.12;

%Group the struct by PHI and V, using 5% as tolerance when creating nominal values for both PHI and V.
[sOut,groups,nomsOut,ids,inds] = groupStruct( s, {'PHI','V'}, [0.05,0.05] );

Requires the 'nominal' function, and the 'getarg' function.

인용 양식

Ivar Eskerud Smith (2024). groupStruct (https://www.mathworks.com/matlabcentral/fileexchange/36897-groupstruct), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2012a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0