フィルターのクリア

How can I do same calculation with a lof of excel files in matlab?

5 ビュー (過去 30 日間)
afrya
afrya 2014 年 12 月 18 日
コメント済み: afrya 2014 年 12 月 18 日
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

回答 (1 件)

Peter Borda
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
  1 件のコメント
afrya
afrya 2014 年 12 月 18 日
Thank you for your answer, It work only for one excel file. I think a for loop would be necessary to perform the calculations for all excel files.

サインインしてコメントする。

カテゴリ

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