Unable to check checkboxes AppDesigner

3 visualizaciones (últimos 30 días)
Colin Krebbers
Colin Krebbers el 20 de Jun. de 2019
Respondida: Jeremy Berke el 11 de Mzo. de 2024
Hi All,
Currently, I'm working on a table which will hold to numeric columns and eight logical columns (in the appeareance of checkboxes).
I've managed to create this table but unless having specified which columns of a row may be edited this does not work.
After configuring the table I set data to it, initializing each checkbox with the false status, being unchecked.
While running the app the checkboxes can be clicked, the tick appears and while releasing the mousebutton dissapears again.
Any help would be great!
Kind regards,
Colin
set(app.GCL, 'ColumnFormat', {'numeric', 'numeric','logical','logical','logical','logical','logical','logical','logical','logical'});
set(app.GCL, 'ColumnEditable', [false, true, true, true, true, true, true, true, true, true]);
newData = [m+1 0 0 0 0 0 0 0 0 0];
app.GCL.Data = [app.GCL.Data;newData];

Respuestas (2)

Dennis
Dennis el 20 de Jun. de 2019
You need to set the values of your checkbox to true or false, not to 0 or 1. MWE:
t=uitable;
t.ColumnFormat={'logical'};
t.ColumnEditable=true;
t.Data=true;
  2 comentarios
Colin Krebbers
Colin Krebbers el 20 de Jun. de 2019
Hi Dennis,
Thank you for your reply!
Definitely, this would work in GUIDE, however, I'm using AppDesigner and it sadly does not.
The table is created and the row consisting out of 2 numeric fields followed by 8 checkboxes is visible, only point is that I'm not able to change the status of the checkbox accordingly.
Looking forward to your reply.
Dennis
Dennis el 21 de Jun. de 2019
Hi,
the problem is not with your table, but with the values you try to assign to your checkboxes.
I don't see why my example should not work for appdesigner, i included a small example.

Iniciar sesión para comentar.


Jeremy Berke
Jeremy Berke el 11 de Mzo. de 2024
I had the same problem and solved it by using a table as the table.Data property.
For example:
lowerBounds = [-20 -20 -20 -20 -20 -20 5 -1 -20 -20]';
upperBounds = [60 60 60 60 60 60 25 1 20 20]';
optimize = logical([1 1 0 1 1 1 1 0 1 1]');
app.paramTable.Data = table(optimize, lowerBounds, upperBounds);
and this solved the issue.

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by