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.

回答(1 个)

José-Luis
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.

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by