Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

uimenu

Create menu or menu items

Syntax

m = uimenu
m = uimenu(Name,Value)
m = uimenu(parent)
m = uimenu(parent,Name,Value)

Description

m = uimenu creates a menu in the current traditional figure and returns the Menu object. If there is no traditional figure available, MATLAB® creates one.

m = uimenu(Name,Value) specifies Menu property values using one or more Name,Value pair arguments.

m = uimenu(parent) creates the menu in the specified figure. The figure can be a traditional figure or a UI figure.

example

m = uimenu(parent,Name,Value) creates the menu in the specified figure and sets one or more Menu property values.

Examples

collapse all

Create a traditional figure. Then add a menu called Import and a menu item called CSV File.

f = figure('ToolBar','none');
m = uimenu(f,'Text','Import');
mitem = uimenu(m,'Text','CSV File');

Create a UI figure and add a menu called Show. Then add a menu item called Data Types that has the Checked property set to 'on'.

f = uifigure;
m = uimenu(f,'Text','Show');
mitem = uimenu(m,'Text','Data Types','Checked','on');

Input Arguments

collapse all

Parent figure, specified as a Figure object returned by the figure or uifigure function. If you do not specify a parent figure, the default parent is a traditional figure.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: m = uimenu('Text','Open') creates a menu and sets its label to 'Open'.

The properties list here are only a subset.

  • For a list of properties available for GUIDE, or for creating apps with the figure function, see Menu Properties.

  • For a list of properties available for App Designer, or for creating apps with the uifigure function, see Menu (App Designer) Properties.

Output Arguments

collapse all

Menu object. Use m to set properties of the menu after creating it.

More About

collapse all

Traditional Figure

A figure that MATLAB creates when you use GUIDE or call the figure function.

UI Figure

A figure that MATLAB creates when you use App Designer or call the uifigure function. For more information on the difference between traditional figures and UI figures, see Graphics Support in App Designer.

Introduced before R2006a

Was this topic helpful?