How do I use the status of a checkbox in the GUI for an input of a switch function?
조회 수: 13 (최근 30일)
이전 댓글 표시
I'm looking to have a few checkboxex that change the possible values of a dropdown menu.
For instance:
If checkbox A is selected, then the dropdown options would be X,Y,Z
If Checkbox B is selected, then the dropdown options would be A,B,C
I'm looking to have a switch function power this process and would think that I could assign a value to the selection of each checkbox and have that execute the switch.
I don't know how to get the checkbox data (numerical value) to the dropdown function.
Any help would be great.
댓글 수: 0
답변 (2개)
Image Analyst
2017년 1월 28일
Try this:
% If checkbox A is selected, then the dropdown options would be X,Y,Z
if handles.checkboxA.Value
handles.dropdown.String = {'X', 'Y', 'Z'};
end
% If Checkbox B is selected, then the dropdown options would be A,B,C
if handles.checkboxB.Value
handles.dropdown.String = {'A', 'B', 'C'};
end
댓글 수: 1
Runo Insan
2020년 3월 14일
편집: Runo Insan
2020년 3월 14일
if handles.checkboxA.Value
%yes, it's true. Do this code 1.
else
%no, it's false. Do this code 2.
end
Walter Roberson
2017년 1월 27일
get(handles.checkbox1,'value')
It will be 0 if not checked and 1 if checked (unless the max and min have been configured differently)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!