MATLAB: Will GUIDE not allow me to make a table smaller than 4 by 2

columneditorguideMATLABnumberpropertyrowrowssinglesize;tableuitable

I am trying to add a table component to my GUI in GUIDE. I would like the table to have three rows and three columns. When I use Table Property Editor dialog to try to delete the last row, pressing 'OK' or 'Apply' will cause the fourth row to reappear.

Best Answer

If you try to reduce the size of a UITABLE object in GUIDE to less than 4 rows or less than 1 column in either of the dimensions, GUIDE will not allow such a deletion, and the deleted dimensions will remain in the UITABLE object.
To work around this issue, follow the steps below:
First, right click on the table and click 'View Callbacks' -> 'CreateFcn'. In the table's CreateFcn code, add the following line:
% set the tables 'Data' property to a cell array of empty matrices.
% The size of the cell array determines the number of rows and columns in the table.
set(hObject, 'Data', cell(3));
If column and row headers are also being used, they must be set programmatically in the CreateFcn as well:
set(hObject, 'RowName', {'R1', 'R2', 'R3'}, 'ColumnName', {'C1', 'C2', 'C3'});