How to Read multiple Images from a Directory.

I am using following code to read my images which are named in term of
1.jpg
2.jpg
3.jpg . .
20.jpg
I am using the following code
for i=1:20
name = sprintf('%d.jpg',i); I=imread(name); end
It works fine in reading but it is overwriting I again and again. The final value of i gives the image read last. which is 20.jpg. How can i store all images separately.
Regards

 採用された回答

Chandra Kurniawan
Chandra Kurniawan 2012 年 1 月 12 日

0 投票

Of course.
Variable I should be a cell-array.
Eq :
I{i} =imread(name);
And when calling your data, you can use the index
Eq:
imshow(I{5});

その他の回答 (1 件)

Tallha Akram
Tallha Akram 2012 年 1 月 12 日

0 投票

Cheers Buddy. I was so stuck in these brackets.

カテゴリ

ヘルプ センター および File ExchangeDICOM Format についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by