how to display using subplot one by one.
2 次查看(过去 30 天)
显示 更早的评论
clc
clear all
c=cell(1,4);
for i=1:4
c{i}=imread(sprintf('%d.jpg',i));
imshow(c{i});
imshow(sprintf('%d.jpg',i));
end
0 个评论
回答(1 个)
Sean de Wolski
2014-12-24
Add this line to the first part of your for-loop
subplot(2,2,i)
1 个评论
Image Analyst
2014-12-24
编辑:Image Analyst
2014-12-24
And add this too
baseFileName = sprintf('%d.jpg',i);
fullFileName = fullfile(pwd, baseFileName);
if exist(fullFileName, 'file')
c{i}=imread(fullFileName);
else
c{i} = [];
message = sprintf('Warning: %s does not exist', fullFileName);
uiwait(warndlg(message));
end
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!