Create an array in which each element is one of your directories and
loop through that.
e.g.
S = {'s001', 's002', ...}
for i=1:length(S), % or i=1:size(S,1)
cd(S{i})
batch
cd ..
end
Please read "Programming Fundamentals" found here:
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_product_page2.html
Andrew Jahn wrote:
> Hi,
>
> I am trying to run a .m file as a script in each of my subject's
> directories, and was wondering how to implement this as a for loop in
> Matlab. I am relatively new to coding in it, and it appears that it
> only takes integers and arrays as arguments. So, for example, if I
> wanted to run batch.m in directories s001, s002...s010, how would I
> begin to go about that?
>
>
> Thank you,
>
> -Andrew
|