Importing batches of data files

조회 수: 2 (최근 30일)
Dan
Dan 2014년 4월 7일
답변: dpb 2014년 4월 7일
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?

답변 (1개)

dpb
dpb 2014년 4월 7일
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...

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by