The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Matlab GUIDE doesn't actually save handles to all components
Replies: 1   Last Post: Jan 17, 2013 1:28 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Steven Lord

Posts: 18,038
Registered: 12/7/04
Re: Matlab GUIDE doesn't actually save handles to all components
Posted: Jan 17, 2013 1:28 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Alexandr " <> wrote in message
> 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.


Steve Lord
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.