Why GUI closes when I use "handles=guidata(hGUI);" in ButtonDownFcn? (Using GUIDE)
1 次查看(过去 30 天)
显示 更早的评论
Good afternoon,
I'm trying to call a ButtonDownFcn when I click on a image that's updating (a frame of a video that is running). I need to use handles to plot a result in a statictext so I decide to write this:
function RawButtonDownFcn(hObject,eventdata)
handles=guidata(GUI_Gobi); %GUI_Gobi is my GUI
set(handles.Infopixel,'String','Has clicado en la imagen');
%Infopixel is a statictext. This is only a test, I want to do some stuff and then send the result to the static test.
When I run the GUI and click on the image, the image closes, the GUI closes, then the GUI open again and appears 'Has clicado en la imagen' in the statictext, but the video is closed.
The problem is this line "handles=guidata(GUI_Gobi);" If I write another code, for example:
function RawButtonDownFcn(hObject,eventdata)
a=5+10
It runs and display the result a=15
These are my files:
Thank you very much.
Alejandro.
0 个评论
采纳的回答
Walter Roberson
2013-3-14
handles=guidata(GUI_Gobi)
means to run the function "GUI_Gobi" and apply the function "guidata" to the result.
You should use
handles = guidata( ancestor(hObject, 'figure') );
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!