在MATLAB中保存excel中的多个数组数据

时间:2017-05-27 15:17:00

标签: matlab

我想在excel表中保存四个变量,以便跟随MATLAB代码。需要你的帮助在代码的最后部分实现相同的。提前谢谢。

clear all;
close all;
for k = 1:9
filename = sprintf('Data_F_Ind000%d.txt',k);
data = load (filename);
alldata = eemd(data(:,1),0.01,10);
I1 = alldata (1,:);
I2 = alldata (2,:);
I3 = alldata (3,:);
I4 = alldata (4,:);
end
xlswrite('imf.xlsx',I1,1);
xlswrite('imf.xlsx',I2,2);
xlswrite('imf.xlsx',I3,3);
xlswrite('imf.xlsx',I4,4);

1 个答案:

答案 0 :(得分:1)

您需要正确使用该功能

  xlswrite(<name of excel>, <matrix to save>, <sheet>, <range>)

例如:

%This writes your I1 matrix in the "yourExcelSheet" sheet into the
% "yourname.xlsx" file starting at the cell A1 and using all the space that
% matrix I1 needs to write
xlswrite ('yourname.xlsx',I1,'YourExcelSheet','A1');