Needs Checkbox to draw a plot

조회 수: 8 (최근 30일)
Aleksandra
Aleksandra 2012년 6월 14일
Hi all, Can you help me with GUI? So I need to create checkbox to draw a plot by clicking mouse on it. How can I do it?

채택된 답변

John
John 2012년 6월 14일
Write an if statement that gets the value of the checkbox. When the checkbox's value is 1 then plot. This snip of code would have to be written under the function of the checkbox.
for example if the checkbox's tag is 'checkbox1' then:
if get(handles.checkbox1,'Value') == 1
plot(......)
end
  댓글 수: 3
John
John 2012년 6월 18일
The if statement takes care of that. It will only plot when the checkbox is highlighted
Aleksandra
Aleksandra 2012년 6월 25일
Got it. Thanks a lot.

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

추가 답변 (1개)

Benjamin Schwabe
Benjamin Schwabe 2012년 6월 14일
Hi Aleksandra,
I am not sure where you are stuck, so I try to be a little more detailed than John.
Use GUIDE to design you GUI with drag and drop. Save the GUI. Then double click on the checkbox and the m-File openes at the callback function of the ckechbox. Then use the if statement as John suggests.
Benjamin
  댓글 수: 1
Aleksandra
Aleksandra 2012년 6월 15일
Thanks a lot.
But how do not plot if the checkbox is not highlighted?

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by