checkbox in table unclickable

30 views (last 30 days)
William Gaillard
William Gaillard on 6 Mar 2019
Answered: Konstantin Patroev on 26 Nov 2020
I have a table generated in Matlab App Designer. The 1st column in the table has check boxes. All other columns are numeric. I have a pushbutton called delete. I want any row that is checked to be deleted from the table when the delete button is clicked on. I don't see anyway to initialize the table format within the App Designer Design View. To set the column format, I have the following startup function in the Code View:
% Code that executes after component creation
function startupFcn(app)
set(app.UITable, 'ColumnFormat', {'logical', 'numeric', 'numeric'});
set(app.UITable,'ColumnEditable',logical([1 1 1]));
end
Data is entered into the table via pushbuttons and edit fields or by clicking a cell and entering a value. In Design View I have all columns set to editable (which does not seem to do anything as far as I can tell). Without the second line in the code above I cannot edit any cell in the table (I would think this code is redundent given that I have all columns set to editable in Design View, but this is not the case). With the second line of code the numberic cells work as expected; however, the checkboxes are not clickable. Any idea why?
When I click a check box I get the following warning:
Warning: Cannot convert logical edit to numeric matrix.
Please click for more information
When I click the link I get the following error
Error using helpUtils.csh.helpviewMLFactory/checkForMapFile (line
27)
Specified map file does not exist:
C:\Program Files\MATLAB\R2018a\help\techdoc\ref\hg.uitable.map
Error in helpview (line 215)
help_path = factory.checkForMapFile(mapfilename, topic_id);
  2 Comments
Colin Krebbers
Colin Krebbers on 20 Jun 2019
Hi William,
Were you able to fix the problem regarding the checkboxes?
I'm facing the exact same issue while reusing your code.
Kind regards,
Colin
William Gaillard
William Gaillard on 11 Jul 2019
Hey Colin,
I have not fixed this problem. I may try the answer by Vili just to see if I can improve on it, but I don't think it will get me where I want to be.

Sign in to comment.

Answers (2)

Vili Keränen
Vili Keränen on 10 Jul 2019
Hey guys,
I'm experiencing the same issue. You probably figured this out already, but you can work around the issue with CellEdit callback.
% Cell edit callback: UITable
function UITableCellEdit(app, event)
indices = event.Indices;
if app.UITable.Data(indices(1),indices(2)) == true % In this example column containing checkboxes
app.UITable.Data(indices(1),indices(2)) = false % is the only editable column.
else
app.UITable.Data(indices(1),indices(2)) = true
end
end
Doesn't remove the error, but atleast checkboxes now change state.

Konstantin Patroev
Konstantin Patroev on 26 Nov 2020
You can manually set this in the App designer intereface, at the bottom right:
Then you set your columns to editable as so:

Categories

Find more on Function Creation 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!