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

Antworten (1)

Sean de Wolski
Sean de Wolski am 24 Dez. 2014

0 Stimmen

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

1 Kommentar

Image Analyst
Image Analyst am 24 Dez. 2014
Bearbeitet: Image Analyst am 24 Dez. 2014
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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 24 Dez. 2014

Bearbeitet:

am 24 Dez. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by