how to read and display multiple images from folder?

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.

 Accepted 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

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!