Ha! Sorry. It turned out that the MyFunction(), a complicated tree of functions, had a "close all" buried in it (to close all plots). I guess the 'close all' closes, at least partially, the caller's GUI; but the odd thing is that the application GUI doesn't "close" it just doesn't work anymore.
corruption of handles and hObject / GUIDE application
    4 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
I have this odd problem within a call back function for a GUI created with 'guide' (this is my first gui app). The handles and hObject variables seem to get corrupted when I call a function (my own function).
case A: This works as expected
function updateButton_Callback(hObject, eventdata, handles)
% hObject    handle to updateButton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.statusUpdater1,'String','start');
%[retcode,retmsg]=MyFunction('dog', 'cat');
set(handles.statusUpdater1,'String','finish');
Case B: This Doesn't work Same as above with the MyFunction() line uncommented. The console error for the 2nd set is: "??? Error using ==> set Invalid handle object." Also hObject appears to be gone too. I tried copying the two before calling the function and restoring, but that didn't help.
Is there anyway that a function call could kill these locals? Is there a way to re-extract these two directly from the "gui_state" or somewhere else in a"guide" built application/m-file?
0 commentaires
Réponse acceptée
Plus de réponses (1)
  Paulo Silva
      
 le 28 Juin 2011
        Try this way:
function updateButton_Callback(hObject, eventdata, handles)
% hObject    handle to updateButton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
sU1H=handles.statusUpdater1;
set(sU1H,'String','start');
[retcode,retmsg]=MyFunction('dog', 'cat');
set(sU1H,'String','finish');
0 commentaires
Voir également
Catégories
				En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

