groupStruct

Group a struct-array by the nominal values for specified fields.
166 download
Aggiornato 29 mag 2012

Visualizza la licenza

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.

Cita come

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

Compatibilità della release di MATLAB
Creato con R2012a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Structures in Help Center e MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release
1.0.0.0