The function dir
could be associated with arrayfun
: it will apply a dir
command to each member of a vector, for instance 3:6
. Here, filenames will refer to four files from 03.dat
to 06.dat
.
Pseudo-code dir('0[3:6].dat')
could be translated by:
filenames = arrayfun(@(x) dir(['0' num2str(x) '.dat']), 3:6);