How can I do same calculation with a lof of excel files in matlab?
3 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Peter Borda
on 18 Dec 2014
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
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!