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

3 Ansichten (letzte 30 Tage)
sukhesh chukkapalli
sukhesh chukkapalli am 24 Mai 2016
Kommentiert: Image Analyst am 24 Mai 2016
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

Antworten (1)

Walter Roberson
Walter Roberson am 24 Mai 2016
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 Kommentar
Image Analyst
Image Analyst am 24 Mai 2016
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).

Melden Sie sich an, um zu kommentieren.

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by