MATLAB: How to read and display multiple images from folder

image processing

I have 13 JPEG images but when i am reading them with a code
I=dir('C:\Users\Vaio\Desktop\new\*.jpg');
for i=1:length(I)
filename=strcat('C:\Users\Vaio\Desktop\new\*.jpg',I(i).name);
I2=imread(filename);
end
it is showing following error why? Error using imread (line 372) File "C:\Users\Vaio\Desktop\new\*.jpga.jpg" does not exist.

Best Answer

folder='C:\Users\Vaio\Desktop\new'
I=dir(fullfile(folder,'*.jpg'));
for k=1:numel(I)
filename=fullfile(folder,I(k).name);
I2{k}=imread(filename);
end
Related Question