MATLAB Creating Graphical User Interfaces

(Barry) #1

9 Examples of GUIDE UIs


Plot Workspace Variables in a GUIDE UI


In this section...
“About the Example” on page 9- 52
“Read Workspace Variables” on page 9- 53
“Read Selections from List Box” on page 9- 54

About the Example


This example shows how to create a UI that uses a list box to display names of variables
in the base workspace, and then plot them. Initially, no variable names are selected in
the list box. The UI contains controls that perform these tasks:


  • Update the list.

  • Select multiple variables in the list box. Exactly two variables must be selected.

  • Create linear, semilogx and semilogy line graphs of selected variables.


The program evaluates the plotting commands in the base workspace. It does no
validation before plotting. When you use this UI, you are responsible for selecting pairs of
variables that can be plotted against one another. The top-most selection is used as the x-
variable, the lower one as the y-variable.
Free download pdf