Borrar filtros
Borrar filtros

Export Structure to csv file

545 visualizaciones (últimos 30 días)
Kathrin Sadus
Kathrin Sadus el 29 de Sept. de 2020
Respondida: Mohammad el 2 de Mzo. de 2022
Hi everyone,
I'm trying to export my data which is saved in a structure to a csv file. The structure is two dimensional but contains vectors in some cells. So far I tried to convert it in a table and save it using writetable, but the vectors were not recorded correctly.
Thanks for any advice,
Kathrin
  2 comentarios
Turlough Hughes
Turlough Hughes el 29 de Sept. de 2020
Can you attach the structure to the question?
Kathrin Sadus
Kathrin Sadus el 29 de Sept. de 2020
Sure! It looks like this one here.

Iniciar sesión para comentar.

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 30 de Sept. de 2020
MATLAB just introduced writestruct(): https://www.mathworks.com/help/matlab/ref/writestruct.html in R2020b. If you have R2020b, you can directly write the struct in a text file.

Más respuestas (2)

Sudhakar Shinde
Sudhakar Shinde el 29 de Sept. de 2020
You can try this:
load Structure_Example.mat
writetable(struct2table(PracTrials), 'Structure_Example.csv')
The output csv file snal looks as below:
  5 comentarios
Kathrin Sadus
Kathrin Sadus el 21 de Oct. de 2020
Thank you very much for your help!
Aneesha
Aneesha el 3 de Dic. de 2021
can you show the format of PracTrails

Iniciar sesión para comentar.


Mohammad
Mohammad el 2 de Mzo. de 2022
Hi,
I tried to used the same method to convert my struct mat file (attached) but failed. Any help is appreciated.

Categorías

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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by