Creating Graphical User Interfaces |
Adding Fields to a Data Structure
GUI data and application data are usually defined as structures to enable you to add fields as necessary. To add a field to a GUI data or application data structure:
guidata
or getappdata
, as appropriate, to retrieve the data structure. If it was saved with guidata
, it has no name and you must use guidata
to retrieve it. If it was saved with setappdata
, you must know its name and the object with which it is associated, and you must use getappdata
to retrieve it.
If you are using GUIDE, GUI data in the form of the handles
structure is passed as an argument to every callback. You do not have to retrieve the handles
structure before changing it.
guidata
or setappdata
, as appropriate, to save the data. This example saves the handles
structure using guidata
.
hObject
is the handle of the object for which the callback was triggered. It is passed automatically to every callback.
Mechanisms for Managing Data | Sharing Data Among a GUI's Callbacks |
© 1994-2005 The MathWorks, Inc.