User`s guide

11 Lay Out a Programmatic GUI
Table
The following code creates a table with handle th. It populates it with the
matrix
magic(5), and then adjusts its size by setting the widt h and height of
its
Position property to that of its Extent property:
th = uitable(fh,'Data',magic(5));
tpos= get(th ,'Po sition')
tpos =
20 20 300 300
texn= get(th ,'Ex tent')
texn =
0 0 407 100
tpos(3) = texn(3);
tpos(4) = texn(4);
set(th, 'Pos itio n', tpos)
By default, the size of a uitable is 300-by-300 pixels, and pixels is the default
Units for u ita ble Position and Extent.ThetablesExtent is calculated to
include its scrollbars, w hich obscure the last row and column of data when
setting the table’s
Position as above.
Table cells can be edited by users if the
ColumnEditable property enables
it. The
CellEditCallback fires whenever a table cell is edited. By default,
cells are not editable.
A uitable has no
Style property, but you can change its appearance in several
ways by setting
11-24