Export Structure to csv file

589 ビュー (過去 30 日間)
Kathrin Sadus
Kathrin Sadus 2020 年 9 月 29 日
回答済み: Mohammad 2022 年 3 月 2 日
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 件のコメント
Turlough Hughes
Turlough Hughes 2020 年 9 月 29 日
Can you attach the structure to the question?
Kathrin Sadus
Kathrin Sadus 2020 年 9 月 29 日
Sure! It looks like this one here.

サインインしてコメントする。

採用された回答

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 Center および File ExchangeCell Arrays についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by