From: us on 26 Mar 2010 15:05 "Diana " <diana.qiu(a)yale.edu> wrote in message <hoivup$n41$1(a)fred.mathworks.com>... > Hello everyone, > > I have a MATLAB script that reads some data from a text file and then does some calculations and writes to another file. I would like to run this script for several thousand files in the same directory that don't have very similar file names. I was wondering how you would go about doing something like this. Is there anything in MATLAB similar to the find command in linux, which allows you to run a command for every file in a directory? > > Thank you! one of the solutions d=dir('*'); % <- retrieve all names: file(s) and folder(s) d=d(~[d.isdir]); % <- keep file name(s), only d={d.name}.'; % <- file name(s) nf=numel(d); for i=1:nf disp(sprintf('working on %5d/%5d: %s',i,nf,d{i})); % do something, eg, % type(d{i}); end us
|
Pages: 1 Prev: help for the use of "load" Next: 3D Plot of Probability Density Function (PDF) Over Time |