how to display using subplot one by one.

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

답변 (1개)

Sean de Wolski
Sean de Wolski 2014년 12월 24일

0 개 추천

Add this line to the first part of your for-loop
subplot(2,2,i)

댓글 수: 1

Image Analyst
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

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

질문:

2014년 12월 24일

편집:

2014년 12월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by