| MATLAB Function Reference | ![]() |
uitable
uitable('PropertyName1',
value1,'PropertyName2',value2,...)
uitable(parent,...)
handle = uitable(...)
uitable creates a 1-by-1 uitable object in the current figure window, using default property values. If no figure exists, a new figure window opens.
uitable('PropertyName1', value1,'PropertyName2',value2,...) creates a uitable object with specified property values. Properties that you do not specify assume the default property values. See the Uitable Properties reference page for information about the available properties.
uitable(parent,...) creates a uitable object as a child of the specified parent handle parent. The parent can be a figure or uipanel handle. If you also specify a different value for the Parent property, the value of the Parent property takes precedence.
handle = uitable(...) creates a uitable object and returns its handle.
After creating a uitable object, you can set and query its property values using the set and get functions.
This example creates an empty table in the current figure. If no figure exists, one is created.
t = uitable;

This example creates a table with a 3-by-3 data matrix. This example specifies the column names, parent, and position of the table:
f = figure('Position',[100 100 300 150]);
dat = rand(3);
cnames = {'X-Data','Y-Data','Z-Data'};
t = uitable('Data',dat,'ColumnName',cnames,...
'Parent',f,'Position',[20 20 250 100]);

This example creates a table with a 3-by-4 array that contains numeric, logical, and string data in the following columns:
First column (Rate): Numeric, with three decimals (not editable)
Second column (Amount): Currency (not editable)
Third column (Available): Check box (editable)
Fourth column (Fixed/Adj): Pop-up menu with two choices: Fixed and Adjustable (editable)
f = figure('Position',[100 100 400 150]);
dat = {6.125, 456.3457, true, 'Fixed';...
6.75, 510.2342, false, 'Adjustable';...
7, 658.2, false, 'Fixed';};
columnname = {'Rate', 'Amount', 'Available', 'Fixed/Adj'};
columnformat = {'numeric', 'bank', [], {'Fixed' 'Adjustable'}};
columneditable = [false false true true];
t = uitable('Units','normalized','Position',...
[0.1 0.1 0.9 0.9], 'Data', dat,...
'ColumnName', columnname,...
'ColumnFormat', columnformat,...
'ColumnEditable', columneditable);

figure, format, inspect, uicontrol, uimenu, uipanel
![]() | uistack | Uitable Properties | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |