Borrar filtros
Borrar filtros

Convert a table to an Excel file using Tofile

1 visualización (últimos 30 días)
Samah EL QASSAH
Samah EL QASSAH el 10 de Ag. de 2017
Respondida: José-Luis el 10 de Ag. de 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.

Respuestas (1)

José-Luis
José-Luis el 10 de Ag. de 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.

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by