필터 지우기
필터 지우기

xlswrite error is " The document may be read-only or encrypted"

조회 수: 6 (최근 30일)
sukhesh chukkapalli
sukhesh chukkapalli 2016년 5월 24일
댓글: Image Analyst 2016년 5월 24일
I am try to store the data in excel sheet. But after some data entered into excel file it showing an error is
Error using xlswrite (line 220)
Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description: Excel cannot access '1.xls'. The document may be read-only or encrypted.
Help File: xlmain11.chm
Help Context ID: 0
Error in A (line 12)
xlswrite('1.xls',n{j},'1',cellRef);
my code is
i=1;
x=cell(1,281);
n=cell(1,281);
for j=26:281
cellRef = sprintf('A%d:BC%d',j,j);
x{j} = imread(sprintf('E:/apps/project/TELUGU data/telugu sep/%d/ (%d).jpg',i,j))
n{j} = feature_extractor_2d(x{j});
xlswrite('1.xls',n{j},'1',cellRef);
end

답변 (1개)

Walter Roberson
Walter Roberson 2016년 5월 24일
If you are using any version before R2016a then I recommend you use xlswrite1 from the File Exchange. Currently each of those xlswrite() within the loop is establishing and closing an ActiveX connection, which is slow enough that sometimes it has not quite finished by the time you want to establish the next connection.
Be sure to read the instructions for xlswrite1
  댓글 수: 1
Image Analyst
Image Analyst 2016년 5월 24일
Yes, definitely. You would not want to call xlswrite 255 times (before R2016a)! It will take forever even if it did work. Most likely reason I think is that Excel still has the file open and you're trying to write to it again, which means it launches Excel and tries to open it again when it's already open.
Better is to just build up your cell arrays first and call xlswrite once, or else use ActiveX (like I do).

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by