1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| function Untitled
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],'ColumnEditable',[true true true],...
'celleditcallback',@toto);
function toto(my_uitable,nouveau_click)
if nouveau_click.NewData ~= 0
data_before_edit = get(my_uitable,'Data');
% rajoute une ligne de 1
set(my_uitable,'Data',[data_before_edit ;ones(1,3)])
end
end
end |
Partager