User`s guide

9 Managing and Sh aring Application Data in GUIDE
Only Handle Graphics MATLAB objects use this property. The following table
summarizes the functions that provide access to application data. For more
details, see the individual function reference pages.
Functions for Managing Application Data
Function Purpose
setappdata
Specify named application data for an object (a figure
or other Handle Graphics object in your GUI). You can
specify more than one named application data for an object.
However, each name must be unique for that object and can
be associated w ith only one value, usually a structure.
getappdata
Retrieve named application data. To retrieve named
application data, you must know the name associated with
the application data and the handle of the object with which
it is associated . If y ou s pe cify a handle on ly, all the ob je ct’s
application data is returned.
isappdata
True if the named application data exists, false otherwise.
rmappdata
Remove the named application data.
Creating Application Data in GUIDE
Use the setappdata function to create application data. This example
generates a 35-by-35 matrix of normally distributed random numbers in the
opening function and creates application data
mydata to manage it:
function mygui_ Open ingFcn(hObject, eve ntda ta, handles, varargin)
matrices.rand_35 = randn(35);
setappdata(hObject,'mydata',matrice s);
Because this code appears in the opening function ( mygu i_OpeningFcn),
hObject is the handle of the GUI figure, and the code sets mydata as
application data for the figure.
9-6