Convert struct with several fields into long table

6 visualizaciones (últimos 30 días)
Aleya Marzuki
Aleya Marzuki el 3 de Nov. de 2020
Comentada: Ameer Hamza el 3 de Nov. de 2020
I have a structure (see image) with 9 fields and 100 rows. Each row is a 200x1 double. As each row has exactly the same dimensions, I was wondering if there was a function I could use to open up the rows to make a long table with 20000 rows?

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 3 de Nov. de 2020
Try this
T = array2table(cell2mat(squeeze(struct2cell(trai)).'), 'VariableNames', fieldnames(trai))
  2 comentarios
Aleya Marzuki
Aleya Marzuki el 3 de Nov. de 2020
worked perfectly, thank you!
Ameer Hamza
Ameer Hamza el 3 de Nov. de 2020
I am glad to be of help!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by