Thread Subject: problem with selection in GUI

Subject: problem with selection in GUI

From: Ye

Date: 17 Aug, 2009 07:15:35

Message: 1 of 7

We are currently using a 'selectdata' function in our GUI program.
We want to use pushbutton to activate the function to select points from a
axes.But after we clicked the button,it said "error in figure:requested figure
handle use in another object".
Can anyone tell us what may be the problem?
Cheers

Subject: problem with selection in GUI

From: qooroo

Date: 17 Aug, 2009 07:31:01

Message: 2 of 7

"Ye " <volkswagen.xu@gmail.com> wrote in message <h6b02n$dma$1@fred.mathworks.com>...
> We are currently using a 'selectdata' function in our GUI program.
> We want to use pushbutton to activate the function to select points from a
> axes.But after we clicked the button,it said "error in figure:requested figure
> handle use in another object".
> Can anyone tell us what may be the problem?
> Cheers

can you post the line of code where you call the figure function? you very probably have the same error as the following:

http://www.mathworks.de/matlabcentral/newsreader/view_thread/147175

-qooroo

Subject: problem with selection in GUI

From: Ye

Date: 17 Aug, 2009 10:50:18

Message: 3 of 7

"qooroo " <qoorooAT@gmailDOT.comREMOVECAPS> wrote in message <h6b0vl$b75$1@fred.mathworks.com>...
> "Ye " <volkswagen.xu@gmail.com> wrote in message <h6b02n$dma$1@fred.mathworks.com>...
> > We are currently using a 'selectdata' function in our GUI program.
> > We want to use pushbutton to activate the function to select points from a
> > axes.But after we clicked the button,it said "error in figure:requested figure
> > handle use in another object".
> > Can anyone tell us what may be the problem?
> > Cheers
>
> can you post the line of code where you call the figure function? you very probably have the same error as the following:
>
> http://www.mathworks.de/matlabcentral/newsreader/view_thread/147175
>
> -qooroo

Hello qooroo,
actually we saw that thread and use what he said and added that.
This is the lines of code we add to the pushbutton call back:

function start_select_Callback(hObject, eventdata, handles)
% hObject handle to start_select (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

figure(get(handles.strikrplot,'parent'))
[pl,x,y] = selectdata('selectionmode','Closest','Label','on');

we want to select point from axes strikeplot

Subject: problem with selection in GUI

From: Ye

Date: 17 Aug, 2009 11:55:19

Message: 4 of 7

but it still said:
??? Error using ==> figure
Requested figure handle in use by another object

Error in ==> selectdata at 299
figure(fighandle)

Error in ==> test1>start_select_Callback at 907
[pl,x,y] = selectdata('selectionmode','Closest','Label','on');

Error in ==> gui_mainfcn at 96
        feval(varargin{:});

Error in ==> test1 at 42
    gui_mainfcn(gui_State, varargin{:});

Error in ==>
@(hObject,eventdata)test1('start_select_Callback',hObject,eventdata,guidata(hObject))


??? Error while evaluating uicontrol Callback

Subject: problem with selection in GUI

From: Mattias

Date: 26 Nov, 2009 11:34:03

Message: 5 of 7

I have exactly the same problem and i've tried the same things. Any solution?

"Ye " <volkswagen.xu@gmail.com> wrote in message <h6bgf7$rqq$1@fred.mathworks.com>...
> but it still said:
> ??? Error using ==> figure
> Requested figure handle in use by another object
>
> Error in ==> selectdata at 299
> figure(fighandle)
>
> Error in ==> test1>start_select_Callback at 907
> [pl,x,y] = selectdata('selectionmode','Closest','Label','on');
>
> Error in ==> gui_mainfcn at 96
> feval(varargin{:});
>
> Error in ==> test1 at 42
> gui_mainfcn(gui_State, varargin{:});
>
> Error in ==>
> @(hObject,eventdata)test1('start_select_Callback',hObject,eventdata,guidata(hObject))
>
>
> ??? Error while evaluating uicontrol Callback

Subject: problem with selection in GUI

From: Yair Altman

Date: 26 Nov, 2009 16:57:03

Message: 6 of 7

"Mattias " <gallimattias.larsson@gmail.com> wrote in message <help3b$9af$1@fred.mathworks.com>...
> I have exactly the same problem and i've tried the same things. Any solution?
>
> "Ye " <volkswagen.xu@gmail.com> wrote in message <h6bgf7$rqq$1@fred.mathworks.com>...
> > but it still said:
> > ??? Error using ==> figure
> > Requested figure handle in use by another object
> >
> > Error in ==> selectdata at 299
> > figure(fighandle)
> >
> > Error in ==> test1>start_select_Callback at 907
> > [pl,x,y] = selectdata('selectionmode','Closest','Label','on');
> >
> > Error in ==> gui_mainfcn at 96
> > feval(varargin{:});
> >
> > Error in ==> test1 at 42
> > gui_mainfcn(gui_State, varargin{:});
> >
> > Error in ==>
> > @(hObject,eventdata)test1('start_select_Callback',hObject,eventdata,guidata(hObject))
> >
> >
> > ??? Error while evaluating uicontrol Callback


A hunch: your GUI figure window was created but left in an interim hidden state. Then when you rerun, it complains that the figure already exists or something similar. To fix this, type the following in the command Window

close all

Now rerun your GUI and everything should be ok

Yair Altman
http://UndocumentedMatlab.com
 

Subject: problem with selection in GUI

From: Steve Levesque

Date: 15 Dec, 2009 22:48:02

Message: 7 of 7

"Ye " <volkswagen.xu@gmail.com> wrote in message <h6bgf7$rqq$1@fred.mathworks.com>...
> but it still said:
> ??? Error using ==> figure
> Requested figure handle in use by another object
>
> Error in ==> selectdata at 299
> figure(fighandle)
>
> Error in ==> test1>start_select_Callback at 907
> [pl,x,y] = selectdata('selectionmode','Closest','Label','on');
>
> Error in ==> gui_mainfcn at 96
> feval(varargin{:});
>
> Error in ==> test1 at 42
> gui_mainfcn(gui_State, varargin{:});
>
> Error in ==>
> @(hObject,eventdata)test1('start_select_Callback',hObject,eventdata,guidata(hObject))
>
>
> ??? Error while evaluating uicontrol Callback

with GUI with many axes defined in the display you can use function like :

plot( handles.axes1, bla bla bla )

and it will select the right display zone. but for function not accepting handle like image() you must use something to select it. something like

figure( the right handle corresponding to axes1)
image(bla bla bla)

if you feed the axes handle instead of the figure handle it gives the very frustrating unhelpfull message : Requested figure handle in use by another object.
what I found is that there is only one figure (handles.figure1) in the GUI but many axes zones.

instead of using this to get the parent figure handle :

figure(get(handles.axes1,'Parent'))
image(bla bla bla)

which always select the overall figure and not the wanted axes1, I use this:

subplot(handles.axes1)
image(bla bla bla)

which seems to select a unknown figure handle related for my axes1 area.
This time I can play with as many display. I do not use subplot to split the figure but it seems to find the right axes1 figure and it is valid syntax in the help.
it solved the problem for me.

Steve

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
requested figur... Steve Levesque 15 Dec, 2009 17:49:09
rssFeed for this Thread

Contact us at files@mathworks.com