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 the current figure and returns the Panel object. If there is no figure available, MATLAB® calls the figure function to create one. Panels cannot contain ActiveX® controls.

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

p = uipanel(parent) creates the panel in the specified parent container. The parent container can be a figure created with either the figure or uifigure function, or a child container such as a panel.

example

p = uipanel(parent,Name,Value) specifies the parent container and one or more properties values.

Examples

collapse all

Create a 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]);

The Scrollable property enables scrolling within a panel that has components outside its borders. Scrolling is only possible when the panel is in a figure created with the uifigure function. App Designer uses this type of figure for creating apps.

Create a panel within a figure. Add six UI components to the panel, with the first three lying outside the upper border of the panel.

f = uifigure;
p = uipanel(f,'Position',[20 20 196 135]);
ef1 = uieditfield(p,'text','Position',[11 165 140 22],'Value','First Name');
ef2 = uieditfield(p,'text','Position',[11 140 140 22],'Value','Last Name');
ef3 = uieditfield(p,'text','Position',[11 115 140 22],'Value','Addess');
dd = uidropdown(p,'Position',[11 90 140 22],'Items',{'Male','Female'});
cb = uicheckbox(p,'Position',[11 65 140 22],'Text','Member');
b = uibutton(p,'Position',[11 40 140 22],'Text','Send');

Enable scrolling by setting the Scrollable property of the panel to 'on'. By default, the scroll box displays at the top.

p.Scrollable = 'on';

Input Arguments

collapse all

Parent container, specified as a figure created with either the figure or uifigure function, or a child container:

  • Panels, tabs and button groups can be containers in either type of figure.

  • Grid layouts can be containers only in figures created with the uifigure function.

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.

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