User`s guide
10 Examples of GUIDE GUIs
• Double-click it and in the Property Inspector, set its Tag property to quit
and its String property to Quit.
• Click the
Callback property to create a callback for the button in the
code file
tablestat.m. GUIDE sets the Callb ack of the Quit item to
quit_Callback.
• Inthecodefile,forthe
quit_Callback function. enter:
close(ancestor(hObject,'figure'))
.
12 Save the GUI in GUIDE, naming it tablestat. fig. This action also saves
thecodefileas
tablestat.m.
Initialize the Data Table
You can use the Opening Function to load data into the table. In this example,
however, you use GUIDE to put data into the Data Set table, so that the data
becomes part of the figure after you save it. Initializing the table data causes
the table to h ave the same number of rows and columns as the variable that
it contains:
1 In the Command Window, access the sunspot demo data set. Enter:
load sunspot.da t
The variable sunspot, a 288-by-2 double array, is displayed in the
MATLAB workspace.
2 Double-click the Data Set table to open the Property Inspector for the
data table.
3 In th
e Property Inspector, click the Table Editor icon
to the right of the
Data
property to open the Table Property Editor.
4 In the Table Property Editor, select Table from the list in the left-hand
column.
5 Select the bottom radio button, Ch an ge data value to the selected
workspace variable b elow .
10-40