| MATLAB® | ![]() |
k = menu('mtitle','opt1','opt2',...,'optn')
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).
To call menu from another ui object, set that object's Interruptible property to 'yes'. For more information, see the MATLAB Graphics documentation.
Example 1
k = menu('Choose a color','Red','Green','Blue') displays

After input is accepted, use k to control the color of a graph.
color = ['r','g','b'] plot(t,s,color(k))
Example 2
K = menu('Choose a color','Red','Blue','Green')
displays on the Command Window
----- Choose a color ----- 1) Red 2) Blue 3) Green Select a menu number:
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).
guide, input, uicontrol, uimenu
![]() | memory | mesh, meshc, meshz | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |