Problem with using ginput in matlab

Hello,
When i run my .m file, one image appears with ginput() in active mode to select something. I select one block so next image appear with again ginput in active mode.
When i click on exit button on image which i kept, then previous image appears with ginput active. But now the problem is that if in this next image, if i directly closes it, then ginput becomes deactivated.
I want to keep it active in all situations.
So, how to do it.??

6 Commenti

Nimisha - you may need to provide some of your code so that we have a better idea of what you are doing and what is happening. Are you using a GUI with buttons to cycle through images? Or a script that creates figures with images on them? Please provide more information.
clc
clear;
mainWindow = figure(1);
% read image file data
[X,map,alpha] = imread('Myimage.jpg');
% display the image
mainCatalogImg = image(X);
axis off
axis image;
% the exit ICON upper left corner X and Y, as well as the button height and
% widths
exitIconX = 845;
exitIconY = 10;
exitIconWidth = 140;
exitIconHeight = 30;
What comes next? Your above code doesn't refer to ginput or indicate what happens when the image/figure is closed...
No, this will display my image with EXIT button on it. When i click somewhere on it, it displays another image with ginput active. And in that another image, when i click on EXIT button, previous image opens again with ginput active. But if i close that image directly then ginput becomes disabled.,
I want to keep ginput active all the times.
How will the exit button appear? Your above code shows some variables for the position and size of the button, but doesn't show how it is displayed nor the callback behind the button.
When you say But if i close that image directly t what do you mean by this? Are you closing the image by pressing the X in the top corner?
yes i am closing image using X button on top corner. If i close in this way, then in previous image, ginput becomes disabled.

Accedi per commentare.

Risposte (1)

Nimisha - why do you assume that pressing the X (close button) of the figure should produce the same behaviour when pressing the exit button?
Presumably you have a callback for your pushbutton that fires whenever you press the exit button. If you want this behaviour to be enforced when you press the X (close button) of the figure, then you will need to add a similar (or same) callback for the figure close request as
set(mainWindow,'CloseRequestFcn',@myCallback);
where myCallback is the function that is the callback to the pushbutton or something similar.

Categorie

Richiesto:

il 2 Gen 2015

Risposto:

il 2 Gen 2015

Community Treasure Hunt

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

Start Hunting!

Translated by