フィルターのクリア

Read-Only in Excel

5 ビュー (過去 30 日間)
Philosophaie
Philosophaie 2013 年 9 月 18 日
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;

回答 (1 件)

Titus Edelhofer
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

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by