xlswrite not saving too an Excel file

2 views (last 30 days)
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 Comments
Robert Roy
Robert Roy on 1 Jun 2016
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 on 1 Jun 2016
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?

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 1 Jun 2016
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)

More Answers (1)

Robert Roy
Robert Roy on 1 Jun 2016
Edited: Robert Roy on 1 Jun 2016
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!