cell2nestedstruct
Aucune licence
CELL2NESTEDSTRUCT provides an alternative method of constructing nested structures. It can be used with NESTEDSTRUCT2CELL (also available at MATLAB Central) for editing and visualizing 1x1 nested structures.
Example:
C = {'water' 'a' '' '' '' 111;...
'water' 'b' '' '' '' 222;...
'melon' '' '' '' '' [];...
'a' 'b' 'c' 'd' 'e' 'aaa';...
'q' 'r' '' '' '' cell(6,2)};
[S] = cell2nestedstruct(C);
[C2] = nestedstruct2cell(S);
isequal(C,C2)
ans =
1
S =
water: [1x1 struct]
melon: []
a: [1x1 struct]
q: [1x1 struct]
The structure is produced row-by-row using the general syntax:
S.row1.row2. ... rowN-1 = rowN;
Thus the following row of the cell array: {'water' 'a' '' '' '' 111}
is equivalent to entering:
S.water.a = 111;
Citation pour cette source
Todd Pataky (2024). cell2nestedstruct (https://www.mathworks.com/matlabcentral/fileexchange/11215-cell2nestedstruct), MATLAB Central File Exchange. Récupéré le .
Compatibilité avec les versions de MATLAB
Plateformes compatibles
Windows macOS LinuxCatégories
- MATLAB > Language Fundamentals > Data Types > Cell Arrays >
- MATLAB > Language Fundamentals > Data Types > Data Type Conversion >
Tags
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.
Version | Publié le | Notes de version | |
---|---|---|---|
1.0.0.0 |