Read-Only in Excel
조회 수: 5 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Titus Edelhofer
2013년 9월 18일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!