how to create new figure with same image when you click on image in axes

1 visualización (últimos 30 días)
asif
asif el 21 de Abr. de 2014
Comentada: asif el 21 de Abr. de 2014
i have a multiple set output images which are to be shown in axes of my gui. now when i click on any one image i want that image to show in a separate figure window.

Respuestas (1)

Walter Roberson
Walter Roberson el 21 de Abr. de 2014
set the callback for the image() object to something like,
function show_in_figure(hObject, event)
hfig = figure();
hax = axes('Parent', hfig);
copyobj(hObject, hax);
axes(hax, 'image');
end
  3 comentarios
Walter Roberson
Walter Roberson el 21 de Abr. de 2014
image(DataMatrixForThisImage, 'Callback', @show_in_figure);
The show_in_figure function could go in a separate .m file -- that is what I would suggest if you are using GUIDE, so that GUIDE does not accidentally overwrite the code when it rebuilds the .m
You can use exactly the same callback for multiple images. The hObject value that MATLAB passes to the callback will be the handle of the image that got clicked on.
Note: you might want to record the output of copyobj() and use it to set() the Position of the image within the axes -- you might also want to set() the Position and visibility of the new axes (which can, in this code, be referenced by hax )
asif
asif el 21 de Abr. de 2014
could you please make an example of it . i have attached my gui -m and fig files with my code. this guide part is really new to me.thank you

Iniciar sesión para comentar.

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by