how to convert table with struct to excel sheet
조회 수: 3 (최근 30일)
이전 댓글 표시
i need to know how to convert this table with struct to an excel files with all the data in ... please if you can help but the code to me ( i don't need file name ) ![the table has many struct](https://www.mathworks.com/matlabcentral/answers/uploaded_files/576747/the%20table%20has%20many%20struct%20.jpeg)
![the table has many struct](https://www.mathworks.com/matlabcentral/answers/uploaded_files/576747/the%20table%20has%20many%20struct%20.jpeg)
댓글 수: 0
채택된 답변
Mohammad Sami
2021년 4월 8일
Not really sure about what your data looks like. Assuming your structs are compatible, you can concatenate them together.
s = vertcat(result.bw{:});
s = struct2table(s);
writetable(s,'myexcel.xlsx');
댓글 수: 4
Mohammad Sami
2021년 4월 10일
Yes that can be done.
if true
n = cellfun(@length,result.bw);
f = repelem(result.fileName,n);
s = vertcat(result.bw{:});
s = struct2table(s);
s.fileName = f;
writetable(s,'myexcel.xlsx');
end
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!