Question

I am using a UITABLE to display some data. After displaying the table i want to add a logical column to the end of the table. And depending on columns checked or unchecked future actions are taken. Any idea Guys?

Était-ce utile?

La solution

An example:

%# initial table
c1 = rand(10,3);
h = uitable('Units','normalized', 'Position',[0 0 1 1], 'Data',c1);

%# add new column of check boxes
c2 = c1(:,1)>0.5;
set(h, 'Data',[num2cell(c1) num2cell(c2)], ...
    'ColumnFormat',[repmat({[]},1,size(c1,2)),'logical'], ...
    'ColumnEditable',[false(1,size(c1,2)),true])

screenshot

You might want to handle the CellEditCallback to perform custom actions.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top