Here's a snippet of code I've used in the past for adding and subtracting rows. I modified it for use with a pushbutton. This assumes that you used GUIDE to create your GUI, but it can be modified if you're creating your interface with a standalone mfile.
function addButton_Callback(hObject,eventdata,handles)
oldDat = get(handles.myTable,'Data');
nRows = size(oldDat,1)
dat = cell(nRows+1,3);
dat(1:nRows,:) = oldDat;
set(handles.myTable,'Data',dat)
guidata(hObject,handles)
function subtractButton_Callback(hObject,eventdata,handles)
oldDat = get(handles.myTable,'Data');
nRows = size(oldDat,1)
dat = cell(nRows-1,3);
dat = oldDat(1:nRows-1,:);
set(handles.myTable,'Data',dat)
guidata(hObject,handles)
You might need to make some changes to fit your needs. At the moment, this assumes a table with 3 columns. The code you posted is at the moment unreadable, but if you format it using the "Code" button in the text editor we can comment specifically on it.
Best Answer