I am trying to display on a GUI a table that shows a comparison between two columns and based on this info, a user can select one of two options (buttons). I have been able to make this GUI, and it functions fairly well, but for some reason the table does not always appear. The buttons and GUI always appear, but sometimes there is a blank space where the table should be. I am using the below code:
fig_gains = uifigure('Position',[500 300 700 600]);
uit = uitable('Parent',fig_gains,'Position',[25 75 650 450], 'Data', gains_comp_table);
textbox = uitextarea(fig_gains,...
'Value', { 'Do you want MANUAL or AUTOMATIC Gain Calculation?';...
['Recording Type: ' signal_type]}, 'Position', [25 530 650 50],...
'fontsize', 18, 'FontWeight', 'bold') ;
uit.ColumnName = {'Channel Names', 'Gains'};
btn_manual = uibutton(fig_gains,'state','Text','MANUAL','Position',[25 25 225 40]);
btn_auto = uibutton(fig_gains,'state','Text','AUTOMATIC','Position',[450 25 225 40]);
I have figured out a solution for the issue.
I added pause(0.1) to the code before defining fig_gains. I am not entirely sure why this works, but it seems to allow all elements of the GUI to appear properly.