Documentation

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.

uitable

Create table user interface component

Syntax

  • t = uitable
  • t = uitable(Name,Value)
  • t = uitable(parent)
    example
  • t = uitable(parent,Name,Value)
    example

Description

t = uitable creates a table user interface component in the current traditional figure and returns the table object. If there is no traditional figure available, MATLAB® creates one.

t = uitable(Name,Value) specifies table property values using one or more Name,Value pair argument pairs.

example

t = uitable(parent) creates the table in the specified parent container. The parent must be one of the following containers: traditional figure, UI figure, tab, panel, or button group.

example

t = uitable(parent,Name,Value) specifies table property values using one or more Name,Value argument pairs.

Examples

collapse all

Create a 3-by-10 table of random integers inside a traditional figure. The Data property specifies the values in the table, and the Position property specifies the location and size of the table within the figure.

f = figure;
t = uitable(f,'Data',randi(100,10,3),'Position',[20 20 262 204]);

Create a 3-by-10 table of random integers inside a UI figure. The Data property specifies the values in the table, and the Position property specifies the location and size of the table within the figure.

uf = uifigure;
t = uitable(uf,'Data',randi(100,10,3),'Position',[20 20 260 204]);

Tables can accommodate a mixture of different data types across the columns.

Create an empty table in a UI figure.

f = figure;
t = uitable(f);

Set the Data property to populate the table with data that is a mixture of different types. Then set the Position property to adjust the location and size of the table to fit the data.

d = {'Male',52,true;'Male',40,true;'Female',25,false};
t.Data = d;
t.Position = [20 20 258 78];

Set the ColumnName property to change the column headings to descriptive names. Set the ColumnEditable property to true so that users can edit the table in the UI. When a user changes a value in the UI, the table's Data property updates to reflect that change.

t.ColumnName = {'Gender','Age','Authorized'};
t.ColumnEditable = true;

Input Arguments

collapse all

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

Name-Value Pair Arguments

Example: 'Data',[1 2 3; 4 5 6]

You can set Table properties using Name-Value pair arguments.

Output Arguments

collapse all

Table object. Use t to set properties of the table after creating it.

More About

collapse all

Traditional Figure

A figure that MATLAB creates when you use GUIDE or call the figure function.

UI Figure

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

Introduced before R2006a

Was this topic helpful?