How get some images from subplot?

2 views (last 30 days)
I have some images display in subplot and then I want select one or some images name of them for my propose in retrieval image
if true
% for i = 1:totalImages
imgname = sortedImgs(i);
imgname = int2str(imgname);
strname = strcat('images\', imgname, '.jpg');
returnedImage = imread(strname);
subplot(5, 4, i+1);
imshow(returnedImage, []);
end
end
Help me with code plz!
  2 Comments
Marta Salas
Marta Salas on 3 Apr 2014
What do you mean by selecting one or some images?
Van Hieu
Van Hieu on 4 Apr 2014
I want get Image name when select some one

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 3 Apr 2014
Try setting a flag in the button down event of each axes that indicates which axes they clicked on.
  2 Comments
Joseph Cheng
Joseph Cheng on 3 Apr 2014
example: (only did this much because you used dinosaurs as your example.)
function untitled()
h=figure(1)
subplot(1,4,1);h1 = imshow('rice.png');
subplot(1,4,2);h2 = imshow('rice.png');
subplot(1,4,3);h3= imshow('rice.png');
subplot(1,4,4);h4 = imshow('rice.png');
set(h1, 'buttondownfcn', {@loads_of_stuff,1});
set(h2, 'buttondownfcn', {@loads_of_stuff,2});
set(h3, 'buttondownfcn', {@loads_of_stuff,3});
set(h4, 'buttondownfcn', {@loads_of_stuff,4});
function loads_of_stuff(src,eventdata,x)
if get(src,'UserData')
set(src,'UserData',0)
title('');
else
set(src,'UserData',1)
title('Selected');
end
fprintf('%s\n',num2str(x));
Van Hieu
Van Hieu on 4 Apr 2014
this useful for me. Can you can write more a example function for get image name?

Sign in to comment.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!