Azzera filtri
Azzera filtri

Convert a table to an Excel file using Tofile

2 visualizzazioni (ultimi 30 giorni)
Samah EL QASSAH
Samah EL QASSAH il 10 Ago 2017
Risposto: José-Luis il 10 Ago 2017
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.

Risposte (1)

José-Luis
José-Luis il 10 Ago 2017
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.

Categorie

Scopri di più su Tables in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by