loop for and file nonexistant

2 ビュー (過去 30 日間)
ra chaaba
ra chaaba 2013 年 8 月 30 日
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

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 30 日
編集済み: Azzi Abdelmalek 2013 年 8 月 30 日
folder='Base'
for k= 1:80
filename=sprintf('%d.jpg',k)
file=fullfile(folder,filename)
im{k}imread(file);
end
  1 件のコメント
ra chaaba
ra chaaba 2013 年 8 月 30 日
thank you very much

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 8 月 30 日
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 件のコメント
ra chaaba
ra chaaba 2013 年 8 月 30 日
thank you

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDenoising and Compression についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by