MATLAB Answers

gui interface not working anymore - Invalid or deleted object.

19 views (last 30 days)
I am using guide to build interfaces since 1 month. I allready created several interfaces that were working fine. I do not know what has happend but since 2 days these interfaces ( 2 out of 4) will not work anymore. Error messages are:
Error using matlab.ui.control.UIControl/set
Invalid or deleted object.
Error in EPS_calculator_complet>EPS_calculator_complet_OpeningFcn (line 76)
set(handles.edit3, 'String', '-');
Reference to non-existent field 'output'.
Error in profil_vertical_v2>profil_vertical_v2_OutputFcn (line 258)
varargout{1} = handles.output;
. Concerning the first problem: edit field still existes in the corresponding .fig file. line 76 is ment to set edit3 field to "-". This worked without any problems before. When controling handles object before line 76, there is handles.edit3 element. But edit3 is empty...
... edit4: [1x1 UIControl] edit3: [1x1 UIControl] pushbutton13: [1x1 UIControl] ...
The second problem seems to be of same nature. handles.output is not existing when entering @_OutputFcn . As handles.output is defined by
handles.output = hObject;
in @_OpeningFcn, it need to be reinitialised somewhere?
I do not understand where these problems come from. I guess that there was un unormal shutdown or something like that so that objects haven't been saved correctly. Is there a way to repair this?
Thank you for your help.


Geoff Hayes
Geoff Hayes on 5 Jul 2016
Remy - how are you launching your GUI? Are you running the GUI through the GUIDE GUI editor, the MATLAB m file editor, or through the command line? Or, are you launching the GUI by double-clicking on the figure file? Note that the latter will open the figure for the GUI only and will not initialize it to a state where it can be used...
Adam on 5 Jul 2016
Can you post your whole OpeningFcn here or upload the .fig and .m?
It is certainly possible to mess up a .fig file, but it doesn't usually happen.
I imagine you can probably ignore the second problem - if you hit an error midway through your OpeningFcn the rest of it will not execute, including the line which assigns handles.output and then calls guidata to save this intpo the GUI's handles. So if you can fix the first problem the second will likely go away.
Remy Billoire
Remy Billoire on 6 Jul 2016
Adam, you were right. By correcting problem in ObeningFcn second problem is solved. First problem is solved by correcting wrong condition on clf. Thx for your help.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 5 Jul 2016
Most likely you either have a "clear" in your OpeningFcn somewhere, or else you deleted your edit3 control. What does it put into the command window if you just put handles on line 76 by itself with no semi colon?
It should print all the fields of handles to the command window and if edit3 is there, you'll see it listed. If it's not there you deleted the control or renamed it.


Sign in to comment.

More Answers (0)

Sign in to answer this question.