reading Excel data from Matlab, slow process
古いコメントを表示
Hi everyone,
Got a question...
I have my data stored as Excel files, I use 'xlread' command to read them, calculate the average, and then write the results again on the same Excel files. I have about 3000 files and each file has 1000 samples. These are the codes for my programme:
clc
clear d
clear all
format long
a=0;
b=0;
c=0;
h=1;
d = zeros(1000, 1);
for count=1:2632
if a==45
a=0;
b=b+1;
end
for cell=11:1010
format bank
d(h,1)=xlsread(['D:\S9_G24' '\X' num2str(a) 'Y'
num2str(b) 'Z' num2str(c) '.xls'],1,['B' num2str(cell)]);
h=h+1;
if h==1001
aver=mean2(d);
xlswrite(['D:\S9_G24' '\X' num2str(a) 'Y'
num2str(b) 'Z' num2str(c) '.xls'],aver,1,'B1012');
a=a+1;
h=1;
end
end
end
Codes are fine, but the time it takes is extremely long. It is killing me as I am a bit in rush to get these results. Should I convert my data to a special format or something? I was wondering if anyone has got a good suggestion to speed up the process. I appreciate your help.
BW,
S:-)
1 件のコメント
Jan
2011 年 11 月 17 日
Please do not post a question twice.
採用された回答
その他の回答 (1 件)
Steven
2011 年 11 月 18 日
1 投票
To get around the fact that the xlsread & xlswrite commands are very slow you'll need to use ActiveX commands. They aren't complicated at all and are explained very clearly on the following website: http://www.orient-lodge.com/node/3430
カテゴリ
ヘルプ センター および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!