xlsread1 suggested by Antonio will take much time

조회 수: 2 (최근 30일)
Haibo
Haibo 2014년 3월 19일
댓글: Chandrasekhar 2014년 3월 19일
I used the xlswrite1 code (proposed by Matt, http://www.mathworks.com/matlabcentral/fileexchange/10465-xlswrite1) to write many similar matrix into one excel file with various Sheets. It worked well, so fast. However, reading this excel file using the xlsread1 code will take much time. For example, 600 Sheets will take 5 mins. Is it normal?

답변 (1개)

Chandrasekhar
Chandrasekhar 2014년 3월 19일
Excel = actxserver('Excel.Application');
workBook = Excel.Workbooks.Open('filename.xls');
workSheets = Excel.Sheets;
for i = 1:workSheets.Count
sheet = get(workSheets,'item',i);
sheetName{i} = sheet.Name;
end
  댓글 수: 2
Haibo
Haibo 2014년 3월 19일
Thanks Akshata. What you suggested is to find out all of the Sheets. I have an excel file with 600 Sheets (12000*6). I used the code
File='C:\Users\Du\Desktop\jg.xlsx';
Excel = actxserver ('Excel.Application');
Excel.Workbooks.Open(File);
Excel.Workbooks.Item('jg.xlsx').RunAutoMacros(1);
if ~exist(File,'file')
ExcelWorkbook = Excel.Workbooks.Add;
ExcelWorkbook.SaveAs(File,1);
ExcelWorkbook.Close(false);
end
Excel.Workbooks.Open(File);
to read the excel file. It will take 234s. Is it too slow?
Chandrasekhar
Chandrasekhar 2014년 3월 19일
I think there is no other method which executes faster than activex.

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

카테고리

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