MATLAB: Add row of uitable using UICONTROL

uicontroluitable

How can increase the number of row of the uitable using uicontrol as shown on the image. I have this code but I can't find a way to make it work,
f = figure('Position',[700 200 240 200],'Name','Add Derated Unit','NumberTitle','off');
derated = uitable(f);
derated.ColumnName = {'Rating(MW)','FOR/State Probability'};
derated.RowName = [];
derated.Data = [0 0; 0 0; 0 0];
derated.Position(3) = derated.Extent(3);
derated.Position(4) = derated.Extent(4);
derated.ColumnEditable = [true true];
btn = uicontrol('Style', 'pushbutton', 'String', 'Add Row',...
'Position', [20 100 50 20], 'Callback', @add_row);
function add_row(btn, ~, derated)
data = get(derated, 'data');
data(end+1,:) = 0;
set(derated,'data',data);

Best Answer

btn = uicontrol('Style', 'pushbutton', 'String', 'Add Row',...
'Position', [20 100 50 20], 'Callback', {@add_row, derated});