Export Structure to csv file
조회 수: 545 (최근 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
댓글 수: 2
채택된 답변
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.
댓글 수: 0
추가 답변 (2개)
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/368419/image.png)
댓글 수: 5
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Cell Arrays에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!