Specifications

Getting Started Example
1-17
write the callbacks – the functions that execute when users activate a
component in the GUI.
The application M-file:
Initializes and launches the GUI.
Contains the callback functions for all components in the GUI.
GUIDE generates this M-file with empty subfunctions for each component that
has a callback associated with it – in this example, the three push buttons and
the popup menu have callbacks.
A Note About Handles and Global Data
A key feature in the generated M-file is the handles structure. This structure
has two purposes. It:
Stores the handles of all controls, menus, and axes used in the GUI.
Stores global data used in the program.
Accessing Handles. Each object handle is stored in a field of the handles
structure having the same name as the object’s
Tag. For example,
handles.data_popup
contains the handle of the popup menu used in this example.
Storing Global Data. You can store data and pass it to any callback using the
handles structure. To do this, create a new field in the handles structure and
save it using the
guidata function. For example, from the callback of the object
whose handle is
h,
handles.x_data = X;
guidata(h,handles)
saves the variable X in the x_data field of the handles structure. guidata then
writes the new version of
handles to the figure’s application data to save it. To
obtain
X in another callback, reference the correct field:
X = handles.x_data;
For more detailed information on the handles structure, see:
Creating and Storing the Handles Structure