Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: Matlab GUIDE doesn't actually save handles to all components
Posted:
Jan 17, 2013 1:28 PM
|
|
"Alexandr " <chechako@ovi.com> wrote in message news:kd92rf$obl$1@newscl01ah.mathworks.com... > Please, can anybody explain next features?! > > M-file code: > function pushbutton1_Callback(hObject, eventdata, handles) > handles.myValue=999; > disp(5); > disp(handles); > > If start this code from M-file with F5 button in the command windows > shows: > > 5 > figure1: 173.0032 > pushbutton1: 179.0032 > axes1: 174.0032 > output: 173.0032 > myValue: 999 > > But if start clicking the .fig file, you will see only: > > 5 > myValue: 999
The function file associated with the GUI includes initialization code that MUST run before you interact with the GUI. Double-clicking the figure file bypasses the function file and does not execute that initialization code.
ALWAYS start a GUIDE-generated GUI by executing the function file, NOT by opening the figure.
> In Matlab HELP it is said: > "When the GUI is fully initialized, the handles structure contains only > handles to all the components in the GUI and custom data added in any > CreatedFcn callbacks and/or the OpeningFcn." > > but at the same time I see error messages about missing fields in the > handles structure.
Note the first part of that sentence. The GUI is only fully initialized once the associated function file executes.
*snip*
-- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com
|
|
|
|