Creating Graphical User Interfaces Previous page   Next Page

Reading the Selections from the List Box

This GUI requires the user to select two variables from the workspace and then choose one of three plot commands to create the graph: plot, semilogx, or semilogy.

Enabling Multiple Selection

To enable multiple selection in a list box, you must set the Min and Max properties so that Max - Min > 1. This requires you to change the default Min and Max values of 0 and 1 to meet these conditions. Use the Property Inspector to set these properties on the list box.

How Users Select Multiple Items

List box multiple selection follows the standard for most systems:

Users must use one of these techniques to select the two variables required to create the plot.

Returning Variable Names for the Plotting Functions

The get_var_names subroutine returns the two variable names that are selected when the user clicks on one of the three plotting buttons. The function

Here is the code for get_var_names:

Callbacks for the Plotting Buttons

The callbacks for the plotting buttons call get_var_names to get the names of the variables to plot and then call evalin to execute the plot commands in the base workspace.

For example, here is the callback for the plot function:

The command to evaluate is created by concatenating the strings and variables that result in the command:


Previous page  Reading Workspace Variables A GUI to Set Simulink Model Parameters Next page

© 1994-2005 The MathWorks, Inc.