MATLAB: How to concatenate image variable

concatenate image variable

Hi,
I have a sequence of images such as – img1,img2…img10 and I need to send them to a function as images via loop. If I use the following code rows, I get vector that include a string variables (like 'img1', 'img2'…) and I can't send them to the function as image:
for i=1:10
Img(i)=['img',num2str(i)];
end
How can I define a vector of these images as a variables not as string for sending them through the function?
Thanks, Itai

Best Answer

YOu can get all the images present in the folder using:
img = dir('*.jpg') ; % give your extension
for i = 1:length(img)
img(i).name
end