Borrar filtros
Borrar filtros

UITable with checkboxes and variable columns

24 visualizaciones (últimos 30 días)
Marcel Rapp
Marcel Rapp el 28 de Sept. de 2023
Comentada: Harald el 3 de Oct. de 2023
Hi,
I want to create a UItable containing Checkboxes. The user of the UI should be able to customize the size of the chechbox table.
My problem ist, that i need to set the property 'logical' in the code for each column.
Following code only runs if the table has 5 columns.
rows = userInputRow;
columns = userInputColumns;
app.SearchedTable.Data = table('size', [rows,colums], ...
'VariableTypes', {'logical', 'logical', 'logical','logical', 'logical'});
Can I change the 'VariableTypes' property to 'logical' for a undefined number of columns?
Thank you!

Respuesta aceptada

Harald
Harald el 28 de Sept. de 2023
Hi Marcel,
instead of {'logical', 'logical', 'logical','logical', 'logical'} you can write repelem({'logical'}, 5). More generally:
app.SearchedTable.Data = table('size', [rows,colums], ...
'VariableTypes', repelem({'logical'}, columns));
Best wishes,
Harald
  2 comentarios
Marcel Rapp
Marcel Rapp el 2 de Oct. de 2023
Thank you!
Harald
Harald el 3 de Oct. de 2023
Hi Marcel,
you are welcome! If this answers your question, please also "accept" the answer.
Thanks and best wishes,
Harald

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by