how to read multiple excel files, apply hampel filter and save them into folder with same names as input files
1 次查看(过去 30 天)
显示 更早的评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/229939/image.png)
3 个评论
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
This task would be a lot easier to accomplish in Visual Basic (VBA).
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!