MATLAB: Modifying uitable using GUIDE

customize uitableguideuitable

I would like to create a Table with default only 1 row and the user can add or delete a row using push buttons. The add and delete part is ok but the table created always stuck at 4 rows. No matter how I change the settings in the Inspector. Besides that I would also do some calculations in the last column cells. How can I customize that?

Best Answer

In the OpeningFcn of your GUI, just set the Data property of the uitable to be a 1x2 (or whatever number of columns) cell array. Something like the following should work
% --- Executes just before untitled is made visible.
function myGUI_OpeningFcn(hObject, eventdata, handles, varargin)
% Choose default command line output for untitled
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% set the table size to be 1x2
set(handles.uitable1,'Data',cell(1,2));
The above was tested with R2014a.
As for customization for calculations in the last column, please be more specific.