MATLAB Function Reference Previous page   Next Page
menu

Generate menu of choices for user input

Syntax

Description

k = menu('mtitle','opt1','opt2',...,'optn') displays the menu whose title is in the string variable '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

Example 1

k = menu('Choose a color','Red','Green','Blue') displays

After input is accepted, use k to control the color of a graph.

Example 2

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


Previous page  memory mesh, meshc, meshz Next page

© 1994-2005 The MathWorks, Inc.