How can I do same calculation with a lof of excel files in matlab?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I ' m working with an excel file in matlab.After importing the excel file in matlab, I do some calculations. I would like to do the same calculations in my programm but with a lof of excel files. Do you have any idea how to do that? Here is my code :
data=xlsread('HM_VN77_31_Fn=15N.xlsx','A9:G4214');
t=data(:,1);
Fn=data(:,2);
Ft=data(:,4);
%%%%%Calcul%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SFn = sgolayfilt(Fn,2,101);
SFt=sgolayfilt(Ft,2,101);
mu=-SFt./SFn;
mu1=mean(mu,1)
MFn1=mean(SFn,1);
Mft1=mean(SFt,1);
Thank you in advance
0 件のコメント
回答 (1 件)
Peter Borda
2014 年 12 月 18 日
I would put all the xls files in the same folder for start, use matlab's dir() function to get the file names in the folder, then make a loop which checks whether the actual file is xls or not.
listing = dir(name);
NumOfFiles = length(listing);
for k = 3:NumOfFiles % strarts from 3, because the first and second elements are '.' and '..'
ActFile = listing(k).name;
if strcmp(ActFile(end-2:end),'xls' ) || strcmp(ActFile(end-3:end) ,'xlsx')
%insertr your code here
end
end
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!