Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

uipanel

Create panel container object

Syntax

p = uipanel
p = uipanel(Name,Value)
p = uipanel(parent)
p = uipanel(parent,Name,Value)

Description

p = uipanel creates a panel in an existing traditional figure and returns the panel object. If there is no figure available, then MATLAB® creates a new traditional figure to serve as the parent. Panels are containers that group UI components together, including other panels. Panels cannot contain ActiveX® controls.

p = uipanel(Name,Value) specifies one or more panel property names and corresponding values. Use this syntax to override the default panel properties.

p = uipanel(parent) creates a panel and designates a specific parent object. The parent argument can be a traditional figure, UI figure, tab, button group or another panel object.

example

p = uipanel(parent,Name,Value) specifies panel property values using one or more Name,Value pair arguments.

Examples

Create Panel With Children in a Traditional Figure

Create a traditional figure containing two panels and a push button. The panels use the default Units property value, 'normalized'. The default units for the uicontrol is 'pixels'

h = figure;
hp = uipanel('Title','Main Panel','FontSize',12,...
             'BackgroundColor','white',...
             'Position',[.25 .1 .67 .67]);
hsp = uipanel('Parent',hp,'Title','Subpanel','FontSize',12,...
              'Position',[.4 .1 .5 .5]);
hbsp = uicontrol('Parent',hsp,'String','Push here',...
              'Position',[18 18 72 36]);

Create Panel With Children in UI Figure

Create a UI figure containing two panels and a button. The panels and button position measurements are in 'pixels'.

fig = uifigure;
pnl = uipanel(fig,'Title','Main Panel','FontSize',12,...
                'BackgroundColor','white',...
                'Position',[20 20 440 321]);
subpnl = uipanel(pnl,'Title','Subpanel','FontSize',12,...
                'Position',[20 20 170 200]);
btn = uibutton(subpnl,'Text','Push here',...
               'Position', [20 20 75 36]);

Input Arguments

collapse all

Parent object of panel, specified as a figure, panel, tab, or button group object. If you do not specify a parent object, the default parent is a traditional figure object.

Name-Value Pair Arguments

Example: 'Title','Options' specifies that the panel title is Options.

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 as Name1,Value1,...,NameN,ValueN.

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

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

More About

collapse all

traditional figure

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

UI figure

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

Tips

If you set the Visible property of a panel object to 'off', then any child objects it contains (buttons, button groups, axes, etc.) become invisible along with the parent panel. However, the Visible property value of each child object remains unaffected.

See Also

Properties

Introduced before R2006a

Was this topic helpful?