Checboxes in uitable checked by default when starting GUI

6 views (last 30 days)
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.

Answers (1)

Walter Roberson
Walter Roberson on 27 Jul 2015
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.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!