How can I do same calculation with a lof of excel files in matlab?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Peter Borda
el 18 de Dic. de 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
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!