how to display using subplot one by one.

2 vues (au cours des 30 derniers jours)
preeti
preeti le 24 Déc 2014
Modifié(e) : Image Analyst le 24 Déc 2014
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

Réponses (1)

Sean de Wolski
Sean de Wolski le 24 Déc 2014
Add this line to the first part of your for-loop
subplot(2,2,i)
  1 commentaire
Image Analyst
Image Analyst le 24 Déc 2014
Modifié(e) : Image Analyst le 24 Déc 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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by