xlswrite not saving too an Excel file

3 次查看(过去 30 天)
Hi guys, Iam having problem saving my results from a code as an excel file, it does comes up as an unregistered 02 file that cant be opened by excel though I am wondering if anyone has had similar problems?
  5 个评论
Robert Roy
Robert Roy 2016-6-1
Apologies, Its a Windows 8, It has previously worked before the code to produce excel files but now it just produces this 02 file which i dont know what it is. Microsoft Office is installed
Image Analyst
Image Analyst 2016-6-1
What do you mean by it "comes up as an unregistered 02 file"? Where does it "come up" as that? In MATLAB, in Excel, in File Explorer? What is an 02 file? What is the filename? Did you not give it an extension of .xlsx?

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2016-6-1
I speculate that the filename you are passing to xlswrite ends in '.02' and that you are expecting xlswrite to add on a .xls or .xlsx extension to that. xlswrite() only automatically adds on extensions if there are no '.' in the file portion of the name (that is, excluding any directory)

更多回答(1 个)

Robert Roy
Robert Roy 2016-6-1
编辑:Robert Roy 2016-6-1
x2=[((-x1/2)):(Res):(x1/2)];
Res=0.004
y2=1
x=5
for j=j1:j2;
for j=l1:l2;
Cr1=[x_start y_start+(l*(y2/Res)) x/Res y2/Res];
Cr = imcrop(YourData, Cr1);
Tresult(:,j)=mean(Cr).';
end
end
start_cell = 'D1'; % starting cell
Sheet = 1; % sheet number
Sheet3=3;
skip_col = 1; % number of empty columns between entries
% transform into cell and insert empty columns
Nrows = size(Tresult,1);
Ncols = size(Tresult,2);
Tresult_cell = cell(Nrows,(1+skip_col)*Ncols);
Tresult_cell(:,1:(1+skip_col):end) = num2cell(Tresult);
% write file
xlswrite(filename,Tresult_cell,Sheet,start_cell);
start='B:B';
[status,message]=xlswrite(filename,stdErr,Sheet3,start);
xlswrite(filename,x2.',Sheet3,start);

Community Treasure Hunt

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

Start Hunting!

Translated by