Struct array conversion
Usage: new = struct2struct(old)
If 'old' is a scalar struct containing arrays (each with the same number of rows, N) then 'new' will be an N-by-1 struct-array whose fields have a single row.
If 'old' is an N-by-1 struct-array whose fields have a single row (e.g. as returned above) then 'new' will be a scalar structure whose fields have N rows.
Either representation can have advantages for representing basic spreadsheet or database information.
A struct of arrays allows fields to be added and removed more easily and eases computation of filtering or sorting indices.
(A struct of arrays is also the format returned from csv2struct.)
A struct-array makes it easier to apply filtering and sorting operations using the computed indices/indicators.
Citation pour cette source
Ged Ridgway (2024). Struct array conversion (https://www.mathworks.com/matlabcentral/fileexchange/27121-struct-array-conversion), MATLAB Central File Exchange. Extrait(e) le .
Compatibilité avec les versions de MATLAB
Plateformes compatibles
Windows macOS LinuxCatégories
Tags
Remerciements
Inspiré par : csv2struct(filename)
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Découvrir Live Editor
Créez des scripts avec du code, des résultats et du texte formaté dans un même document exécutable.
struct_array_conversion/
struct_array_conversion/html/
Version | Publié le | Notes de version | |
---|---|---|---|
1.0.0.0 |