Importing batches of data files

2 visualizaciones (últimos 30 días)
Dan
Dan el 7 de Abr. de 2014
Respondida: dpb el 7 de Abr. de 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?

Respuestas (1)

dpb
dpb el 7 de Abr. de 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...

Categorías

Más información sobre File Operations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by