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

 채택된 답변

Mohammad Sami
Mohammad Sami 2021년 4월 8일

1 개 추천

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

8*1 struck number 2 in first photo show that table when i click on it ( every cell give information about images) ..
your code work great thank you very much mohamed ♥ but if i want to add a file name to excel sheet ? can I ?
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
Dr mohamed ur code was working good when i update matlab now i try to make it don't work when i wrote
n = cellfun(@length,result.bw);
it says Error using cellfun
Input #2 expected to be a cell array, was struct instead.
what is the problem ?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by