UITable with checkboxes and variable columns

조회 수: 19 (최근 30일)
Marcel Rapp
Marcel Rapp 2023년 9월 28일
댓글: Harald 2023년 10월 3일
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일
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개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by