MATLAB Function Reference |
Generate menu of choices for user input
Syntax
Description
k = menu('mtitle','
displays the menu whose title is in the string variable opt1
','opt2
',...,'optn
')
'
mtitle
'
and whose choices are string variables '
opt1
'
, '
opt2
'
, and so on. menu
returns thenumber of the selected menu item.
If the user's terminal provides a graphics capability, menu
displays the menu items as push buttons in a figure window (Example 1), otherwise they will be given as a numbered list in the command window (Example 2).
Remarks
To call menu
from another ui object, set that object's Interruptible
property to 'yes'
. For more information, see the MATLAB Graphics documentation.
Examples
k = menu('Choose a color','Red','Green','Blue')
displays
After input is accepted, use k
to control the color of a graph.
displays on the Command Window
The number entered by the user in response to the prompt is returned as K
(i.e. K = 2
implies that the user selected Blue
).
See Also
guide
, input
, uicontrol
, uimenu
memory | mesh, meshc, meshz |
© 1994-2005 The MathWorks, Inc.