table to excel code update

1 次查看(过去 30 天)
hussain abdelaziz
hussain abdelaziz 2021-7-18
in matlab 2020 my code was working very good when i update to 2021 my code didn't work any more and it says Error using cellfun
Input #2 expected to be a cell array, was struct instead.
my code was i don't know what is change in matlab 2021a ? and how to correct it
to convert table with struct to excel sheet
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
  3 个评论
Walter Roberson
Walter Roberson 2021-7-18
https://www.mathworks.com/matlabcentral/answers/795837-how-to-convert-table-with-struct-to-excel-sheet?s_tid=srchtitle appears to be relevant.
So whatever was storing cell array of struct array into the table object is storing something else instead. We would need the code that is creating the bw variable in the table object.
hussain abdelaziz
hussain abdelaziz 2021-7-23
this is in attachment the code which get the table ?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by