Importing batches of data files

2 vues (au cours des 30 derniers jours)
Dan
Dan le 7 Avr 2014
Réponse apportée : dpb le 7 Avr 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?

Réponses (1)

dpb
dpb le 7 Avr 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...

Catégories

En savoir plus sur File Operations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by