How to read jpg images in a loop

4 visualizzazioni (ultimi 30 giorni)
Hashem Burki
Hashem Burki il 3 Mar 2011
Risposto: ck il 15 Gen 2020
Hi, I'm new in this. I have 4 images named: img1.jpg, img2.jpg, img3.jpg, and img4.jpg. All i have to do is read them one by one in a for loop. How can i do that?

Risposta accettata

Paulo Silva
Paulo Silva il 3 Mar 2011
c=cell(1,4);
for i=1:4
c{i}=imread(sprintf('img%d.jpg',i));
end
  3 Commenti
preeti
preeti il 24 Dic 2014
hi if i want to show images also what i hav to add in this code.
Image Analyst
Image Analyst il 24 Dic 2014
put this in the loop
subplot(2,2,i);
imshow(c{i});

Accedi per commentare.

Più risposte (1)

ck
ck il 15 Gen 2020
How can I loop through images I read in, when the images have different names and numbers?

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by