How get some images from subplot?
2 views (last 30 days)
Show older comments
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
Accepted Answer
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
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));
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!