Effacer les filtres
Effacer les filtres

xlswrite not saving too an Excel file

6 vues (au cours des 30 derniers jours)
Robert Roy
Robert Roy le 1 Juin 2016
Commenté : Robert Roy le 2 Juin 2016
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 commentaires
Robert Roy
Robert Roy le 1 Juin 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 le 1 Juin 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?

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 1 Juin 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)
  1 commentaire
Robert Roy
Robert Roy le 2 Juin 2016
That seems to work thanks very much

Connectez-vous pour commenter.

Plus de réponses (1)

Robert Roy
Robert Roy le 1 Juin 2016
Modifié(e) : Robert Roy le 1 Juin 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!

Translated by