Export Structure to csv file

435 次查看(过去 30 天)
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

采纳的回答

Ameer Hamza
Ameer Hamza 2020-9-30
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.

更多回答(2 个)

Sudhakar Shinde
Sudhakar Shinde 2020-9-29
You can try this:
load Structure_Example.mat
writetable(struct2table(PracTrials), 'Structure_Example.csv')
The output csv file snal looks as below:
  5 个评论
Kathrin Sadus
Kathrin Sadus 2020-10-21
Thank you very much for your help!
Aneesha
Aneesha 2021-12-3
can you show the format of PracTrails

请先登录,再进行评论。


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

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by