Hello everyone,
This is a follow up to a question I posted previously (link below). With the help of Evan, I was able to add or remove rows to my 'uitable' depending on the number entered in an 'edit' text box. The following code achieved that:
oldData = get(handles.table_uitable,'Data')nRows = str2num(get(hObject,'String'))testSize = size(oldData,1)if nRows > size(oldData,1) dat = cell(nRows,3) dat(1:testSize,:) = oldDataelseif nRows < size(oldData,1) dat = oldData(1:nRows,:)endset(handles.table_uitable,'Data',dat)guidata(hObject,handles)
The problem is on the sixth line when assigning the old values. I have tried multiple things with no luck. It comes down to dealing with cells or numbers. Cells are needed to get the right amount of rows, but numbers are needed when attempting to retain the old values. Any suggestions on how I can keep the old data?
Thank you in advance for any help provided.
Best Answer