User`s guide

Ways to Manage Data in a GUIDE GUI
adds the field number_errors to the ha ndle s structure and sets it to 0.
2 Use the following com mand to save the data:
guidata(hObject,handles)
where hObject is the handle of the component for which the callback was
triggered. GUIDE then autom atically passes the
hObject to every callback.
Changing GUI Data in a Code File Generated by GUIDE
In GUIDE-generated code, the handles structure alw ays represents GUI
data. The next example updates the
handles structure, and then saves it.
Assume that the
handles structure contains an application-defined field
handles.when whose value is 'now'.
1 Change the value of handles.when,to'later' in a GUI callback. This
does not save the
handles structure.
handles.when = 'later';
2 Save the changed version of the handles structure with the command
guidata(hObject,handles)
where hObject is the handle of the component for which the callback was
triggered. If you d o not save the
handles structure w ith guidata,youlose
the change you made to it in the previous step.
Using GUI Data to Control Initialization
You can declare a GUI to be a “singleton,” which m eans only one instance
of it can execute at one time. See “GUI A llow s Only One Instance to R un
(Singleton) on page 5-13. The
CreateFcns of components in a singleton G UI
are only called the first time it runs; subsequent invocations of the GUI do not
execute the
CreateFcns because all the objects already exist. How ever, the
opening function is called every time a singleton GUI is invoked.
If your GUI performs initialization actions in its
OpeningFcn,youmight
want some or all of them to occur only the first time the GUI runs. That
is, if the user invoked the GUI again from the C ommand Line or by other
9-9