Read thousands of xls file from a folder fast.
2 次查看(过去 30 天)
显示 更早的评论
Hello,
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';
f=fullfile(folder,filetype);
d=dir(f);
for k=1:numel(d);
data{k}= xlsread(fullfile(folder,d(k).name),'C27:C29');
a=data{1,k};
if size(a) == [0,0]
b(k) = 0;
x(k) = 0;
else
b(k)=a(3,1)/a(1,1);
x(k)=(b(k)-1)/(b(k)+1);
end
end
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 个评论
回答(1 个)
Siriniharika Katukam
2019-11-12
Hi
As per the above linked documentation, it is suggested that you use readmatrix, readcell, readtable instead of xlsread.
1 个评论
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 Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!