Importing batches of data files

2 views (last 30 days)
Dan
Dan on 7 Apr 2014
Answered: dpb on 7 Apr 2014
I have an experiment that outputs large numbers of data files where I use matlab to convert the output to a useable format. Unfortunately the naming conventions used by the equipment aren't very consistent. Is there a way to put a large number of files in a folder and have matlab open them without having to know the filename beforehand? For example if I have files X,Y,Z in a folder is there a way to open X, perform an operation on the data, then open Y and repeat for all files in the folder without knowing the file names?

Answers (1)

dpb
dpb on 7 Apr 2014
Sure, just iterate thru a directory listing...
d=dir(*.*); % use appropriate wildcards to filter if needs be...
for i=1:length(d)
x=open(d(i).name); % return whatever's in the file
... % do whatever here...

Categories

Find more on File Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!