how to resolve this error?

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

 采纳的回答

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

6 个评论

how to fix this error?
post your code (the concerned part)
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
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}
thanx but there is another problem when image get change gui figure loads every time which doesn't look nice how to solve this?
This is not clear

请先登录,再进行评论。

更多回答(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 个评论

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 Exchange 中查找有关 Startup and Shutdown 的更多信息

产品

标签

Community Treasure Hunt

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

Start Hunting!

Translated by