Please im having this messeage displayed when using xlswrite function

27 次查看(过去 30 天)
Warning: Added specified worksheet. > In xlswrite>activate_sheet at 284 In xlswrite>ExecuteWrite at 256 In xlswrite at 213 In mainanalysis at 17

采纳的回答

Cedric
Cedric 2015-8-22
编辑:Cedric 2015-8-22
This is a warning that informs you that you are operating on a spreadsheet that doesn't exist, and hence adding it to the workbook. If you know that it is normal, you can disable this warning specifically as follows (put it before the call to XLSWRITE):
warning( 'off', 'MATLAB:xlswrite:AddSheet' ) ;
  2 个评论
Tijjani Aminu Kuda
Tijjani Aminu Kuda 2015-8-22
编辑:Cedric 2015-8-22
Thank you.
But actually I want to saving data using for loop, with the loop iteration specifying the sheet number. it works for sometme then start giving me error: could not save in xlsx file rather in .csv file. attached is the programme.
close all;
clear all;
fs = 44100;
Ts= 1/fs;
N = 11025;
load F81.mat
for k1 = 1:20
m =F84(k1,:);
imf = emd(m);
for k = 1:length(imf)
b(k) = sum(imf{k}.*imf{k});
end
E = sum(m.^2);
sal = b/E;
filename = 'test.80.xlsx';
sheet = k1;
xlRange1 = 'B5';
xlswrite(filename,sal,sheet,xlRange1);
c = zeros(1,30);
for k = 1:30
r = corrcoef(m(1:N-k),m(1+k:end));
c(k) = r(1,2);
end
filename = 'test.80.xlsx';
sheet = k1;
xlRange2 = 'B15';
xlswrite(filename,c,sheet,xlRange2);
z = zeros(1,30);
for k = 1:30
z(k) = mai(m,k);
end
filename = 'test.80.xlsx';
sheet = k1;
xlRange3 = 'B25';
xlswrite(filename,z,sheet,xlRange3);
end
Cedric
Cedric 2015-8-22
编辑:Cedric 2015-8-22
Is it still crashing if you replace all:
sheet = k1;
with
sheet = sprintf( 'Sheet%d', k1 ) ;
Note that, as Walter mentions below, it is very slow to access series of sheets using XLWRITE/XLSREAD.

请先登录,再进行评论。

更多回答(1 个)

Walter Roberson
Walter Roberson 2015-8-22
xlswrite() starts up and stops Excel every time. It is not suitable for using in a longer loop. I think I recall that Image Analyst has written that xlswrite() does not always clean up resources sufficiently so after enough calls it will start to fail (it might not be the fault of xlswrite, it might be activex.) xlswrite1() is offered as a solution; see above

标签

Community Treasure Hunt

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

Start Hunting!

Translated by