MATLAB: Shows table in gui panel

MATLAB

Hi
I have made this code to show my table in gui, but the table just pops up and does not show in the gui application
handles.T = table((1:(size(nCoord,1)-1))',x_globalx(:,1),x_globay(:,1),x_globarz(:,1), 'VariableNames',VarNames)
fig = uifigure;
uit = uitable(fig, 'Data',handles.T);
set(handles.uitable1, 'Data', handles.T); ( this is the one i think i have made wrong )

Best Answer

"Error using matlab.ui.control.Table/set; Functionality not supported with figures created with the figure function."
handles.T should be a cell array instead of a table. You can either create the cell array directly instead of creating a table, or you can convert the table to a cell array using table2cell().
Then you can use
set(handles.uitable1, 'Data', handles.T);
% cell array ^^^^^^^^^