【MATLAB】チェックボックスツリーのチェック状態を取得する方法
조회 수: 7 (최근 30일)
이전 댓글 표시
チェックボックスツリーを作成しました。
このとき、各ノードのチェック状態がONかoFFかを取得したいですが、方法が分かりません。
例:child2 == on のときLEDが光る 等を行いたいです。よろしくお願いいたします。
fig = uifigure('Name','config');
checkbox = uitree(fig,'checkbox','Position',[170 20 150 200]);
parent = uitreenode(checkbox,'Text','pare');
chil1 = uitreenode(parent,'Text','chil1');
chil2 = uitreenode(parent,'Text','chil2');
chil3 = uitreenode(parent,'Text','chil3');
expand(checkbox)
댓글 수: 0
채택된 답변
交感神経優位なあかべぇ
2023년 10월 17일
편집: 交感神経優位なあかべぇ
2023년 10월 17일
各ノードのチェック状態は、checkboxtreeのCheckedNodesプロパティで管理されているようです。
child2の状態を判定する例を書きます。
fig = uifigure('Name','config');
checkbox = uitree(fig,'checkbox','Position',[170 20 150 200]);
parent = uitreenode(checkbox,'Text','pare');
chil1 = uitreenode(parent,'Text','chil1');
chil2 = uitreenode(parent,'Text','chil2');
chil3 = uitreenode(parent,'Text','chil3');
expand(checkbox);
isCheckedChil2 = ismember(chil2, checkbox.CheckedNodes) % child2の状態の判定
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 uifigure ベースのアプリ에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!