Read thousands of xls file from a folder fast.

2 ビュー (過去 30 日間)
Razvan Inte
Razvan Inte 2019 年 10 月 29 日
コメント済み: Walter Roberson 2019 年 11 月 12 日
I have to read 20k or more xls files from a folder. From the xls I need just the values from between C26 and C29, this values are used after in some calculations.
So far i have this script:
clc, close, clear all
folder ='Folder adress';
filetype = '*.xls';
for k=1:numel(d);
data{k}= xlsread(fullfile(folder,d(k).name),'C27:C29');
if size(a) == [0,0]
b(k) = 0;
x(k) = 0;
It take the script about 30 minuters up to an hour to read all the excel files.Sometime the excel applicaion crash during the process.
There is another method to do this faster?
How can I stop excel from crashing (stop working)?
Thank you!
  3 件のコメント
Razvan Inte
Razvan Inte 2019 年 10 月 30 日
The problem is not necessary the time. But I read somewhere that there is another way to import data from excel, by open excel just once throug the entire duration of the process. Anyway the main problem is that during the import process the excel stop working.
Walter Roberson
Walter Roberson 2019 年 11 月 12 日
Do you happen to have Parallel Computing Toolbox ?


回答 (1 件)

Siriniharika Katukam
Siriniharika Katukam 2019 年 11 月 12 日
As per the above linked documentation, it is suggested that you use readmatrix, readcell, readtable instead of xlsread.
  1 件のコメント
Walter Roberson
Walter Roberson 2019 年 11 月 12 日
But how are the timings of those comapred to xlsread talking to excel ?
(I do not have a Windows system with Excel installed, so I cannot test that.)



Help Center および File ExchangeSpreadsheets についてさらに検索


Community Treasure Hunt

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

Start Hunting!

Translated by