batch processing unknown number of txt files

my data are in txt format. I don't know how many txt files I will have every time before exporting them. And their names were already determined by the software when I exported them. Can I still use matlab for batch processing?

 Accepted Answer

Stephen23
Stephen23 on 8 Aug 2016
Edited: Stephen23 on 8 Aug 2016
Of course you can batch-process using MATLAB:
S = dir(fullfile(pathname,'*.txt'));
out = cell(size(S));
for k = 1:numel(S)
filename = S(k).name;
filepath = fullfile(pathname,filename);
... do whatever with each file
out{k} = ... save any data
end
And read this for a more detailed explanation:

More Answers (0)

Categories

Asked:

on 8 Aug 2016

Commented:

on 8 Aug 2016

Community Treasure Hunt

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

Start Hunting!