User`s guide

10 Examples of GUIDE GUIs
Read Selections from List Box
TheGUIrequirestheusertoselecttwovariablesfromtheworkspaceand
then choose one of three plot commands to create the graph:
plot, semilogx,
or
semilogy.
No callback for the list box exists in the GUI code file. One is not needed
because the plotting actions are initiated by push buttons.
Enable Multiple Selection
To enable multiple selection in a list box, you must set the Mi n and Max
properties so that Max - Min > 1.YoumustchangethedefaultMin and Max
values of 0 and 1 to meet these conditions. Use the Property Inspector to
set the se properties on the list box.
How U sers Select Multiple Items
List box m ultiple selection follows the standard for most systems:
Ctrl+click left mouse button noncontiguous multi-item selection
Shift+click left mouse button contiguous multi-item sele ction
Users must use one of these techniques to select the two variables required
to create the plot.
Return Variable Names for the Plotting Functions
The get_var_names subfunction re turns the two variable names that are
selected when the user clicks one of the three plotting buttons. The function:
Gets the list of all items in the list box from the
String property.
Gets the indices of the selected items from the
Value property.
Returns two string variables, if there are two items selected. Otherwise
get_var_names displays an error dialog box stating that the user must
select two variables.
Hereisthecodefor
get_var_names:
function [var1, var2 ] = get_var_names(h andl es)
10-64