groupStruct

Group a struct-array by the nominal values for specified fields.
166.0 次下载
更新时间 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