Convert a table to an Excel file using Tofile

조회 수: 2 (최근 30일)
Samah EL QASSAH
Samah EL QASSAH 2017년 8월 10일
답변: José-Luis 2017년 8월 10일
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