imellipse doesn't work on GUI axes

Dear all,
I have a GUI with an axes where I display an image. By pressing a pushbutton, I would like to apply the imellipse function on this image, but it fails and I don't have any idea why (in my opinion it doesn't make any sense):
% --- Executes on button press in hand_pushbutton.
function pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to hand_pushbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I = imread('coins.png');
handles.axes, imshow(I);
h = imellipse(handles.axes);
The error messege I get is:
??? Error using ==> hittest
Invalid object handle
Error in ==> ipthittest at 33
h = hittest(hFigure, currentPoint);
Error in ==> findLowestManagedObject at 16
hit_test_obj = imshared.ipthittest(hFigure,currentPoint);
Error in ==> iptPointerManager>createPointerManager/updatePointer at 280
overMe = findLowestManagedObject(hFigure,currentPoint);
Error in ==> iptPointerManager>createPointerManager/enablePointerManager at 218
updatePointer(figHandle, lastCurrentPoint);
Error in ==> iptPointerManager at 72
pointerManager.API.enable();
Error in ==> ellipseSymbol>setupCursorManagement at 301
iptPointerManager(h_fig);
Error in ==> ellipseSymbol>initialize at 121
setupCursorManagement();
Error in ==> imrect>imrectAPI at 220
draw_api.initialize(h_group)
Error in ==> imrect>imrect.imrect at 83
[h_group,draw_api] = imrectAPI(varargin{:});
Error in ==> imellipse>imellipse.imellipse at 89
obj = obj@imrect(varargin{:},'DrawAPI',ellipseSymbol());
Error in ==> newGUI>pushbutton_Callback at 997
h = imellipse(handles.axes);
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> newGUI at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)newGUI('pushbutton_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
Can you please give me a hint why this error occurs? Thank you in advance!

Respuestas (4)

Erwin
Erwin el 28 de Feb. de 2012

0 votos

Nobody has an idea? I would really appreciate a hint because it seems an absolutely weird MATLAB problem to me. Thank you

1 comentario

Alex Taylor
Alex Taylor el 28 de Feb. de 2012
Erwin, I just sent you an email. If you can distill this into a simple example, I'd be happy to take a look and get back to you.

Iniciar sesión para comentar.

Walter Roberson
Walter Roberson el 28 de Feb. de 2012
The line
handles.axes, imshow(I);
is going to output the numeric handle number for handles.axes, and is then going to imshow() against whatever the current axes happens to be at the time.
Use
imshow(I, 'Parent', handles.axes);
Image Analyst
Image Analyst el 28 de Feb. de 2012

0 votos

Did it actually print a number to the command window when it hit this line: handles.axes ??? Are you sure that is the name of the axes? If you hover the cursor over handles (when it's stopped there because of a breakpoint) does it list axes as one of the members of the "handles" structure?
Erwin
Erwin el 29 de Feb. de 2012

0 votos

Thank you for your answers and your help!
@ Image Analyst: Yes, handles.axes is the name of my axes and it prints out a number to the command window.
Meanwhile, I just copied all elements from my GUI and created a new GUI which is indentical to my old one. It runs without any problem!!! I don't have any idea why that problem occured in my privious GUI, to me it seems to be magic...

Categorías

Preguntada:

el 28 de Feb. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by