How to transform struct to array?

1 view (last 30 days)
Kiryl Zhaliazka
Kiryl Zhaliazka on 23 Mar 2022
Answered: Voss on 23 Mar 2022
I have struct with 96 fields, each field contein 1 number, how I can make array that will be contain one column and 96 rows, each row is a number from each field. Thank you.

Accepted Answer

Voss
Voss on 23 Mar 2022
S = struct('field_1',1,'field_2',2,'field_3',3)
S = struct with fields:
field_1: 1 field_2: 2 field_3: 3
A = struct2array(S).'
A = 3×1
1 2 3

More Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!