필터 지우기
필터 지우기

How should I know whether and which checkboxs are selected?

조회 수: 4 (최근 30일)
Donghui  Sun
Donghui Sun 2013년 8월 26일
In main panel, there are several checkboxs, such as A...D. Each checkbox is bounding a selection for my application.How should I know whether and which checkboxs are selected?
Any suggestions?

채택된 답변

Image Analyst
Image Analyst 2013년 8월 26일
checkbox1State = get(handles.checkbox1, 'Value');
checkbox2State = get(handles.checkbox2, 'Value');
checkbox3State = get(handles.checkbox3, 'Value');
and so on.
  댓글 수: 1
Donghui  Sun
Donghui Sun 2013년 8월 26일
Thanks. I have read the help document about this issue. And I can determine the current state of a check box from within its callback by querying the state of its Value property .
if (get(hObject,'Value') == get(hObject,'Max'))
% Checkbox is checked-take appropriate action
handles.chexkbox1 = 1
else
handles.ckeckbox1 = 0;
end

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by