Filter löschen
Filter löschen

how to read multiple excel files, apply hampel filter and save them into folder with same names as input files

3 Ansichten (letzte 30 Tage)
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 Kommentare
bushra fatima
bushra fatima am 17 Jul. 2019
Thankyou for your response
'y' is currently output file (result of hampel filter). I want to save data as csv file and want to generate same names as input files. How can I generate file name in loop and save them to a folder. my main is to apply hampel filter to 20 files and save them to a folder.
Bob Thompson
Bob Thompson am 17 Jul. 2019
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'];

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Mario Chiappelli
Mario Chiappelli am 18 Jul. 2019
This task would be a lot easier to accomplish in Visual Basic (VBA).

Kategorien

Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by