UITable with checkboxes and variable columns

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!

 採用された回答

Harald
Harald 2023 年 9 月 28 日

0 投票

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 件のコメント

Marcel Rapp
Marcel Rapp 2023 年 10 月 2 日
Thank you!
Harald
Harald 2023 年 10 月 3 日
Hi Marcel,
you are welcome! If this answers your question, please also "accept" the answer.
Thanks and best wishes,
Harald

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品

リリース

R2022b

質問済み:

2023 年 9 月 28 日

コメント済み:

2023 年 10 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by