MATLAB: How can we change the default size table in GUIDE

guidetable

In my GUI, I want table of size 2×2. But the default size of table in GUIDE is 4×2. How can I change this default size?

Best Answer

Shil - in the OpeningFcn of your GUI, just set the Data property of the uitable to be a 2x2 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 2x2
set(handles.uitable1,'Data',cell(2,2));
The above was tested with R2014a.