How can I filter multiple files ?

Technical Source
1 min readMar 9, 2021

--

I have made a filter as following

[b,a] = butter(9,.02,’low’); x=textread(‘noisy.out’); y=filter(b,a,x); save filtered.out y -ASCII

I have 1000 files and I would like to filter all my files using the above filter. Is there any way that I can do this efficiently? my files are named like 1.out 2.out , … 1000.out

any suggestion would be appreciated.

my *.out files just include one column with numbers

this is one example -4.034E+02 -4.007E+02 -3.987E+02 -3.978E+02

All numbers in one column and each file contains 13000 numbers

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

Parse the folder for existing 1–1000.out files and import them one-by-one apply filter and save:

% Retrieve all the files in a directory
names = dir('C:\Users\Oleg\Desktop\Nuova cartella');
names = {names(~[names.isdir]).name};
% Select only the files #.out
idx = ~cellfun('isempty',regexp(names,'\d+\.out'));
names = names(idx);
% Filter
[b,a] = butter(9,.02,'low');
for n = names
% Open file for reading

SEE COMPLETE ANSWER CLICK THE LINK

https://www.matlabsolutions.com/resources/how-can-i-filter-multiple-files-.php

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet