how to read multiple excel files, apply hampel filter and save them into folder with same names as input files
이전 댓글 표시
Hi everyone
I have 20 excel files in a folder, I want to read those files, apply hampel filter and save them into a folder with same names.
files=dir('E:\EEG_RECORDING\Male_Data\*.csv');
files=files(~[files.isdir]);
n=length(files);
for i=1:n
data=xlsread(fullfile(files(i).folder, files(i).name));
a=hampel(data,y)
end
I am not getting how to apply filter and save the files. Here is attachement of error.

댓글 수: 3
Bob Thompson
2019년 7월 16일
What is 'y,' and what is the class of 'data?'
What file format do you want to save your data as? The exact command is going to depend on what format you want, but you'll just add another line to the interior of your for loop to save the file.
bushra fatima
2019년 7월 17일
Bob Thompson
2019년 7월 17일
Making a file name within a loop is usually accomplished by concatonating a string. I will provide an example, but you will have to change it to come up with your specific desired output.
y = [files(i).folder,'\output_',num2str(i),'.csv'];
답변 (1개)
Mario Chiappelli
2019년 7월 18일
0 개 추천
This task would be a lot easier to accomplish in Visual Basic (VBA).
카테고리
도움말 센터 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!