loop for and file nonexistant

6 vues (au cours des 30 derniers jours)
ra chaaba
ra chaaba le 30 Août 2013
hi,
I have a folder 'Base' that contains 80 images (image 1 is called '1. jpg ', the second is '2. jpg', ............ '80. jpg ') I want to read these images using a loop for.I writethis:
for i = 1:80 imread ('Base \% d.jpg ', i);
but an error stating nonexistent file.
What's the problem. Please help

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 30 Août 2013
Modifié(e) : Azzi Abdelmalek le 30 Août 2013
folder='Base'
for k= 1:80
filename=sprintf('%d.jpg',k)
file=fullfile(folder,filename)
im{k}imread(file);
end
  1 commentaire
ra chaaba
ra chaaba le 30 Août 2013
thank you very much

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 30 Août 2013
Spacing is important. '%d' not '% d' for example. But a more immediate problem is that imread() must be given a complete file name; it will not construct one like you have shown.
  1 commentaire
ra chaaba
ra chaaba le 30 Août 2013
thank you

Connectez-vous pour commenter.

Catégories

En savoir plus sur Denoising and Compression dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by