%{ uitable is a mechanism to work with excel worksheets. Bug report #63388 can be looked at as displaying different worksheets on a same uitable. This report is about an issue detected from implementing a basic row operation within a worksheet, given that the functionality to add/delete uitable row/column is unavailable. Octave uitable syntax follows an older version of matlab uitable that matlab still supports. To detect the cell selection, 'cellselectioncallback' is the only method I know in this older syntax. A user case below shows that, in this user case, 'cellselectioncallback' is not exercised when the cells of a row are selected. Please use the steps below to illustrate the issue. % show the selection not working right after row deletion (or table content change). (a)uitable_delete in command window (b)click on 5 of the row name. All row 5 cells highlighted. 'cellselectioncallback' displays 'Row(s) 5 Selected' in command window. (c)click on 3 of the row name. All row 3 cells highlighted. 'cellselectioncallback' displays 'Row(s) 3 Selected' in command window. (d)click 'delete row' push button on the right of the figure. Row 3 is deleted. Table contents below Row 3 move up. (e)click on 3 of the row name. All row 3 cells highlighted but 'cellselectioncallback' displays nothing. 'cellselectioncallback' is not exercised when the cells are highlighted/selected. <== THIS IS THE ISSUE (f)(optional) click 'delete row' push button. Nothing happens because the selected row is not defined by 'cellselectioncallback'. (g)click on 3 of row name. All row 3 cells highlighted again but 'cellselectioncallback' still displays nothing. 'cellselectioncallback' is not exercised. (h)(optional) click delete row push button. Nothing happens because the selected row is not active through 'cellselectioncallback'. (i)click on any other row or any cell. Everything is back to normal. Then click 3 of the row name. Row 3 works again. %} function []=uitable_delete(varargin) % table data=num2cell(round(100*rand(5,3))); fid=figure('name', 'delete example', 'tag', 'example'); h=uitable(fid, 'units', 'normalized', ... 'Position', [ 0.1 0.15 0.7 0.6 ], ... 'data', data, ... 'ColumnWidth', { 100, 100, 100}, ... 'cellselectioncallback', @selected, ... 'tag', 'uitable'); % sync the rowname with col #1 of the table for ii=1:size(data,1), data(ii,1)= num2str(ii); end; set(h, 'data', data); % delete button h_delete= uicontrol (fid,'style', 'pushbutton', ... 'units', 'normalized', ... 'string', 'Delete Row', ... 'value', 0, ... 'position', [0.825 0.5 0.15 0.04], ... 'backgroundcolor', [0.94000 0.94000 0.94000], ... 'fontsize', 10, 'fontweight', 'bold', ... 'callback', @delete_cmd, ... 'tag', 'delete_cmd'); end % function delete_cmd(varargin) hndl=findobj(0, 'tag', 'uitable'); data=get(hndl,'data') ; [m,n]=size(data); ind_row=getappdata(findobj(0, 'tag', 'example'), 'selected') ; % [] if nothing selected if ~isempty(ind_row) ind_keep=setdiff(1:m, ind_row); data=data(ind_keep,:); set(hndl, 'Data', data); % use out the ind_row data. reset. setappdata(findobj(0, 'tag', 'example'), 'selected', []); else %{ do nothing %} end end function []=selected(app, event) % matlab/Octave uitable properties are very different % fieldnames(event), % [1,1] = Indices nothing else disp('Entering cellselectioncallback'); ind =unique(event.Indices, 'rows'); % disp(ind) ind_row=unique(event.Indices(:,1), 'rows'); % disp(ind_row) data=get(findobj(0, 'tag', 'uitable'), 'Data') ; % register only if the whole row is selected if rem(size(ind,1),size(data,2))==0, setappdata(findobj(0, 'tag', 'example'), 'selected', ind_row ); disp(['Row(s) ' num2str(reshape(ind_row, 1, []), '%i ') ' selected']); end end