필터 지우기
필터 지우기

Can I add unknown number of check boxes in live editor?

조회 수: 1 (최근 30일)
Harry Cho
Harry Cho 2022년 3월 30일
편집: Harry Cho 2022년 3월 30일
Hi,
I have a table and one of the vatiables in the table is categorical. I would like to add a check box per each category in live editor. However, I do not know how many categories are in the variable until I load it from a file. The file is being continuously updated by someone else, not changing columns but adding more rows which could have new categories. Is it possible to add check boxes programatically in live editor?
I am currently using R2021b. If there is no solution, can R2022a help? I read a new feature, "Live Editor: Develop your own Live Editor tasks", but am not sure if it is a (only) solution.
Thank you for your help in advance.

답변 (1개)

Simon Chan
Simon Chan 2022년 3월 30일
Suppose your data is a cell array, update your uitable by the following:
uit.Data = [data,num2cell(false(size(data,1),1))]; % or you may use true instead of false
In case all your data are numeric and in a form of matrix, you can update the uitable via:
uit.Data=[num2cell(data),num2cell(false(size(data,1),1))]
  댓글 수: 2
Harry Cho
Harry Cho 2022년 3월 30일
편집: Harry Cho 2022년 3월 30일
Thank you for the reply.
I have no experience in UI and couldn't understand the proposed solution. How does it work in live editor? I can manually insert a check box but would like to do it programatically as I have to add unknown number of check boxes.
Simon Chan
Simon Chan 2022년 3월 30일
May be I misunderstand your question. I am referring to the checkbox inside the uitable. I think it is much more easy because the number of checkboxes depends on the number of rows from your data.
See this documentation: uitable

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by