Export Structure to csv file
447 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kathrin Sadus
am 29 Sep. 2020
Beantwortet: Mohammad
am 2 Mär. 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 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 30 Sep. 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.
0 Kommentare
Weitere Antworten (2)
Sudhakar Shinde
am 29 Sep. 2020
You can try this:
load Structure_Example.mat
writetable(struct2table(PracTrials), 'Structure_Example.csv')
The output csv file snal looks as below:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/368419/image.png)
5 Kommentare
Mohammad
am 2 Mär. 2022
Hi,
I tried to used the same method to convert my struct mat file (attached) but failed. Any help is appreciated.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Cell Arrays finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!