Checboxes in uitable checked by default when starting GUI

Dear community,
I´ve been trying to solve a apparent simple problem for several days now:
I created a GUI using GUIDE with an UITABLE. I added some data to the uitable with 4 columns. The last column is a checkbox with logicals.
Now everything works fine, but I want that the checkboxes are checked by default when the GUI is started and not unchecked, as it is the case now.
My input data for the table is a 73 x 3 cell:
'String 1' 'String 2' [ 1.234]
The only thing I found is to use in the Createfunction and " true " the
set(hObject,'Data',...)
command, but I can´t manage to correctly complete the command, so that the checkboxes are displayed as being checked. I would be utmost grateful for every help.

回答(1 个)

newdatacell = [existing_data_cell, repmat({true},size(existing_data_cell,1),1)];
set(handles.uitable1, 'Data', newdatacell);
That is, the 4th column needs to be initialized to a non-zero value in order for the 4th column to show up as checked.

类别

帮助中心File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by