NSTRUCT2CELL

버전 1.0.0.0 (1.42 KB) 작성자: Mathias Benedek
Conversion of nested structure to cell, providing overview and easy access to all sub-fields
다운로드 수: 357
업데이트 날짜: 2011/1/4

라이선스 보기

C = NSTRUCT2CELL(S)

Recursive function that converts a nested struct S with a total of n sub-fields into a nx2 cell array C.
The first column of C lists the full names of the sub-fields and the second column contains the respective content.
In order to display long field names set format to long.

Example:

S.a.b = 1:3;
S.a.c = 1:6 > 3;
S.d(1).e = {'ABC','DEF'};
S.d(2).f = 'text';

S
S =
a: [1x1 struct]
d: [1x2 struct]

C = nstruct2cell(S)
C =
'S.a.b' [1x3 double ]
'S.a.c' [1x6 logical]
'S.d(1).e' {1x2 cell }
'S.d(1).f' []
'S.d(2).e' []
'S.d(2).f' 'text'

C{3,2}
ans =
'ABC' 'DEF'

인용 양식

Mathias Benedek (2024). NSTRUCT2CELL (https://www.mathworks.com/matlabcentral/fileexchange/29908-nstruct2cell), MATLAB Central File Exchange. 검색됨 .

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

줌: getnestedfield

Community Treasure Hunt

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

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