You are on page 1of 3

1.

To ra bng d liu bng cch s dng cu lnh

t = uitable;

2. y d liu ln table bng cu lnh

set(t,'Data',magic(10))

3. Hiu chnh chiu rng mi ct bng cu lnh

set(t,'ColumnWidth',{25})
4. To ra mt figure v thm bng c 3 hng 3 ct. Thit lp tn cho cc ct cc hng, v tr ca
table

f = figure('Position',[200 200 400 150]);

dat = rand(3);

cnames = {'X-Data','Y-Data','Z-Data'};

rnames = {'First','Second','Third'};

t = uitable('Parent',f,'Data',dat,'ColumnName',cnames,...

'RowName',rnames,'Position',[20 20 360 100]);


5. To mt bng cha ma trn 3 hng 4 ct cha d liu s , logical, and chui k t nh hnh

Ct 1 (Rate): Numeric (not editable)

Ct 2 (Amount): Currency (not editable)

Ct 3 (Available): Check box (editable)

Ct 4 (Fixed/Adj): Pop-up menu vi 2 la chn: Fixed and Adjustable (editable)

Xa RowName

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', 'logical', {'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,...

'RowName',[]);

You might also like