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.


Create panel container object


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


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.


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


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,...
             '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,...
                '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

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: 'Title','Options' specifies that the panel title is Options.

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.


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.

Introduced before R2006a

Was this topic helpful?