Read-Only in Excel
    5 views (last 30 days)
  
       Show older comments
    
When I execute the code below it prints out in Excel ok but it is in "Read-Only". How do I stop "Read-Only"?
exl = actxserver('excel.application');
exlWkbk = exl.Workbooks;
exlFile = exlWkbk.Open(['C:/MATLAB7/work/file.xls']);
exlSheet1 = exlFile.Sheets.Item('Sheet1');
mm=2
for t = 0:500:10000
    mm=mm+1
    vx1=6*t-800
    vy1=3*t-300
    vz1=2*t-100
    vr1=(vx1^2+vy1^2+vz1^2)^.5
        exlSheet1.Range(['B' num2str(mm)]).value = vx1;
        exlSheet1.Range(['C' num2str(mm)]).value = vy1;
        exlSheet1.Range(['D' num2str(mm)]).value = vz1;
        exlSheet1.Range(['E' num2str(mm)]).value = vr1;
end
        exl.visible = true;
exlWkbk.Close;
exl.Quit;
0 Comments
Answers (1)
  Titus Edelhofer
    
 on 18 Sep 2013
        Hi, I'm not sure what your question is. But in any case you will need to call
exlWkbk.Save
before you close it, since you modified it before. Second, if you get an error of "Read only", the natural question is: is your file read only (i.e., write protected)?
Titus
0 Comments
See Also
Categories
				Find more on Data Import from MATLAB in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!