Convert a table to an Excel file using Tofile
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a Simulink model where I use two GUIs to exploit it. When I run the first GUI I get the values of a variable FT1FinalListToFT0 using the Tofile block, so I get as output a table of different values.
I used the following code to convert the array to .xlsx
data=load('FT1FinalListToFT0.mat');
f=fieldnames(data);
for k=1:size(f,1)
xlswrite('testFT1.xlsx',data.(f{k}),f{k})
end
Using a simulation time of 10, the file is created without any problems but when I use simulation time 'inf', I get the following error:
How to correct the error please.
And then I have another question, how can I retrieve the last value of the array to use it after when I run the 2nd GUI to continue to use the model.
0 个评论
回答(1 个)
José-Luis
2017-8-10
Are you sure that all the variables in your .mat file are valid for xlswrite()?
From the documentation data.f{k}, should be an:
Input matrix, specified as a two-dimensional numeric, character array, or string array , or, if each cell contains a single element, a cell array.
It doesn't look like you have that.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!