Change table of structs into columns of data in a table
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Centauri Jolene
am 8 Sep. 2020
Kommentiert: Centauri Jolene
am 9 Sep. 2020
I have many tables which contain anywhere from 2000 - 7500 1x1 structs in one column. Each struct contains a value for x, y and z positions. I need to extract these 3 numbers from each struct and have them in their own columns (as just regular floats). The end result will be a table with a column for x values, a column for y values, and a column for z values.
I've attached an example file (.mat).
What is an efficient way to do this?
0 Kommentare
Akzeptierte Antwort
Mohammad Sami
am 8 Sep. 2020
Based on your example data this will work. All structs must have the exact same fields, otherwise this will fail
flattened = struct2table(vertcat(data{:,1}));
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Structures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!