User`s guide
9 Managing and Sh aring Application Data in GUIDE
• GUI d ata is a single variable; how ever, when defined as a structure, you
can add and remove fields.
• Application data can consist of many variables, each stored under a
separate unique name.
• GUIDE uses GUI data to store its handles structure, to which you can add
fields, but should not remove any.
• You access GUI data using the
guidata function, which both stores and
retrieves GUI data.
• Whenever you use
guidata to store GUI data, it overwrites the existing
GUI data.
• Using the
getappdata, setappdata,andrmappdata functionsdoesnot
affect GUI data.
GUI Data in GUIDE
GUIDE uses guidata to create and maintain the handles structure. The
handles structure contains the handles of all GUI components. GUIDE
automatically passes the
handles structure to every callback as an input
argument.
In a GUI created using GUIDE, you cannot use
guidata to manage any
variable other than the
handles structure. If you do, you can overwrite the
handles structure and your GUI will not work. To use G UI data to share
application-defined data among callbacks, you can store the data in fields
that you add to the
handles structure. See “handles Structure” on page 8-22
for more information. The GU IDE templates use the
handles structure to
store a pplication-defined data. See “Select a GUI Template” on page 6-6 for
information about the templates.
Adding Fields to the handles Structure
To add a field to the handles structure, which is passed as an argument to
every callback in G UIDE, take these steps:
1 Assign a value to the new field. This adds the field to the structure. For
example:
handles.number_errors = 0;
9-8