uitable

Creates a table in a figure.

Syntax

h = uitable()

h = uitable(property, value, ...)

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

Inputs

parent
Handle of a container object, which could be a figure, frame, uipanel, or uibuttongroup.
Type: double | integer
property, value
'columnname'
Specifies the column labels of h. Valid values are 'numbered'(default) or cell with label names.
Type: string | cell
'columnwidth'
Specifies the width of the data columns. By default, the value is 'auto', where column widths are automatically adjusted. Individual column widths can be defined in a cell array of size (1, n), where n is the number of columns in 'data'. The values in each of the cell array columns specify the width.
Type: cell | string
'data'
Table data. If the data type is cell array, the cell elements can only be one of the following types scalar_int_bool_complex_string.
Type: cell | mat
'enable'
Specifies if h is enabled. Valid values are 'on'(default) and 'off'.
Type: string
'fontangle'
Specifies angle of the displayed font. Valid values are 'regular'(default) and 'italic'.
Type: string
'fontname'
Specifies name of the displayed font.
Type: string
'fontsize'
Specifies size of the displayed font.
Type: scalar
'fontweight'
Specifies weight of the displayed font. Valid values are 'normal'(default) and 'bold'.
Type: string
'parent'
Specifies the parent.
Type: scalar
'position'
Position and size of h. Value is specified as a vector of form: [left top width height]. If 'units' has a value of 'normalized', values must be between 0 to 1.
Type: vector
'tag'
User-defined string to tag graphical control objects.
Type: string
'tooltipstring'
Tooltip to display.
Type: string
'units'
Specifies units of measurement. Valid values are 'pixels'(default) and 'normalized'. Value 'pixel' indicates that h has a fixed size and position specified by 'position'. Value 'normalized' indicates that h will be resized if parent is resized.
Type: string
'userdata'
User-defined numerical data.
Type: complex | mtx | scalar
'visible'
Specifies if h is visible. Valid values are 'on'(default) and 'off'.
Type: string

Outputs

h
Handle of the uitable.

Examples

Display matrix data in a table:
uitable('data', rand(3, 3));
Display cell array data in a table:
uitable('data', {'Apple',2,true;'Banana',3,true;'Coco',5,false});
Display matrix data with specific column widths and names:
h = uitable('data', rand(2, 3), 'columnwidth', {50, 100, 150}, 'columnname', {'col1', 'col2', 'sum'});