Hi all,

I am new in Matlab.
Code:
for img=1:5
a=imread(['input\m',int2str(img),'.pgm']);
:
:
imwrite(I2,['result\m',int2str(img),'.pgm']);
end
My code can only run if i change the filenames to m1,m2......
Before this, my filename is m-001-1.pgm,.....,m-002-1.pgm,...,m-003-1.pgm....
Is there any way to make a loop to read this original filename?
I have done this in C by searching for m*.pgm, then all the files with "m" in front will be read. How about Matlab?