a=imread(imgNameList(i,:));
>> slideshow Index exceeds matrix dimensions.
Error in slideshow (line 14) a=imread(imgNameList(i,:));

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 1 日
編集済み: Azzi Abdelmalek 2014 年 2 月 1 日

0 投票

That means the value of i exceeds the number of element in imgNameList . you can check it by typing
size(imgNameList)
disp(i)

6 件のコメント

romasha
romasha 2014 年 2 月 1 日
how to fix this error?
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 1 日
post your code (the concerned part)
romasha
romasha 2014 年 2 月 1 日
編集済み: Walter Roberson 2014 年 2 月 1 日
imgNameList=char('images.jpg','images (1).jpg','images (2).jpg','download.jpg','images (4).jpg','images (5).jpg','images (6).jpg','images (7).jpg','eye3.jpg');
pause on;
for i=1:length(imgNameList)
a=imread(imgNameList(i,:));
imshow(a); drawnow; pause(2);
end
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 1 日
編集済み: Azzi Abdelmalek 2014 年 2 月 1 日
imgNameList should be a cell array
imgNameList={'images.jpg','images (1).jpg','images (2).jpg','download.jpg','images (4).jpg','images (5).jpg','images (6).jpg','images (7).jpg','eye3.jpg'}
To get each file use
imgNameList{i}
romasha
romasha 2014 年 2 月 1 日
thanx but there is another problem when image get change gui figure loads every time which doesn't look nice how to solve this?
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 1 日
This is not clear

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2014 年 2 月 1 日

1 投票

imgNameList = {'images.jpg','images (1).jpg','images (2).jpg','download.jpg','images (4).jpg','images (5).jpg','images (6).jpg','images (7).jpg','eye3.jpg'};
pause on;
for i = 1:length(imgNameList)
a = imread(imgNameList{i});
imshow(a); drawnow; pause(2);
end

2 件のコメント

romasha
romasha 2014 年 2 月 1 日
thanx :-)
romasha
romasha 2014 年 2 月 1 日
thanx but there is another problem when image get change gui figure loads every time which doesn't look nice how to solve this?

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

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by