how to display using subplot one by one.

조회 수: 3 (최근 30일)
preeti
preeti 2014년 12월 24일
편집: Image Analyst 2014년 12월 24일
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일
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

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

카테고리

Help CenterFile 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