uitab

Creates a tab in a tabbed frame for interactive graphical control objects in a figure.

Syntax

h = uitab(parent)

h = uitab(parent, property, value, ...)

Inputs

parent
Handle of a container object, which is a uitabgroup.
Type: double | integer
property, value
backgroundcolor
Specifies the background color. Valid values are transparent or a real vector specifying RGB values in the range 0-255 or 0-1.
Type: string | vector
createfcn
Function that is triggered when h is created. If value is a function handle, it must be a function that takes at least two arguments. The first argument is the handle of the uicontrol and the second argument is ignored. If value is a string, it must represent a function handle or a function name. If value is a cell, it must contain the function name/function handle in the first cell element and parameters to pass to callback function in the additional elements. createfcn cannot be interrupted.
Type: cell | functionhandle | string
deletefcn
Function that is triggered when h is deleted. If value is a function handle, it must be a function that takes at least two arguments. The first argument is the handle of the uicontrol and the second argument is ignored. If value is a string, it must represent a function handle or a function name. If value is a cell, it must contain the function name/function handle in the first cell element and parameters to pass to callback function in the additional elements. deletefcn cannot be interrupted.
Type: cell | functionhandle | string
enable
Specifies if h is enabled. Valid values are on(default) and off.
Type: string
fontangle
Specifies the angle of the displayed font; applies to all tabs in this group. Valid values are regular(default) and italic.
Type: string
fontname
Specifies the name of the displayed font; applies to all tabs in this group.
Type: string
fontsize
Specifies the size of the displayed font; applies to all tabs in this group.
Type: scalar
fontunits
Determines if fontsize property is absolute or relative based on fontsize of the parent. Valid values are pixels (default) or normalized.
Type: string
fontweight
Specifies the weight of the displayed font; applies to all tabs in this group. Valid values are normal(default) and bold.
Type: string
iconpath
Path to the icon to be displayed next to uitab name.
Type: string
parent
Specifies the parent (uitabgroup).
Type: scalar
tag
User-defined string to tag uitab.
Type: string
title
Text to be displayed on h.
Type: string
tooltipstring
Tooltip.
Type: string
userdata
User-defined numerical data.
Type: complex | mtx | scalar
value
User-defined scalar data.
Type: scalar

Outputs

h
Handle of the uitab created.

Examples

Creates a tabbed frame, with tabs containing uicontrol elements:
% Creates a tab group in the current figure
h = uitabgroup(gcf())

% Creates individual tabs
tab1 = uitab(h, 'title', 'My tab 1')
tab2 = uitab(h)

% Creates uicontrol elements in individual tabs
edithandle = uicontrol(tab1,'style','edit','string','169','units','normalized','position',[0.1 0.15 0.15 0.15]);

lst10 = uicontrol(tab2, 'Style','listbox','units','normalized', ...
'String',{'data1','data2','data3','data4','data5','data6','data7'},'max',3,'min',0,'value',[2,3],
'visible', 'on', 'units','normalized','position',[0.1 0.1 0.15 0.15]);
Creates a tab with a toolbar:
% Callback for uipushtool
function pushtool3_callback(handle, data, varargin)
  printf('Executing callback, handle: [%f]\n', handle);
end

% Figure
Dialog = figure('units', 'pixels', 'position', [0 0 734 459], 'name','Dialog');

% Tab group
tabWidget = uitabgroup('parent', Dialog, 'units','normalized', 'position',[0.07 0.33 0.75 0.56]);

% Tab 1
tab = uitab('parent', tabWidget, 'title','Tab 1');

% Tab 2
tab_2 = uitab('parent', tabWidget, 'title','Tab 2');

set(tabWidget, 'selectedtab', tab);

toolbar = uitoolbar(tab);

pushtool1 = uipushtool(toolbar, 'iconpath', 'msfolder.png', 'separator', 'on');
pushtool2 = uipushtool(toolbar, 'iconpath', 'TableView-16.png'); % Adds to current toolbar
pushtool3 = uipushtool(toolbar, 'iconpath', 'mslist.png', 'clickedcallback','pushtool3_callback');
pushtool4 = uipushtool(toolbar, 'arrowtype', 'left');
Figure 1. Horizontal toolbar in a tab