how to combine if loop with or

조회 수: 1 (최근 30일)
Kuang-Yu WANG
Kuang-Yu WANG 2018년 7월 27일
댓글: Rik 2018년 7월 27일
i create a if loop that if i push button1. the program will get the number of edit1. same as button2. however i want to add 2 checkbox for each edit. than just use one button to control. In predict, if i tick 2 checkbox and than push the button, it will show 2 numbers. if i tick one, the program should show 1 number.But in reality, the new program don't have any output. please help!!
  댓글 수: 3
Kuang-Yu WANG
Kuang-Yu WANG 2018년 7월 27일
yes, i use a single callback in toggle button that
function sample(hObject,eventdata, handles)
if get(str2num(handles.edit1,'string')) && get(handles.checkbox1,'value')==1
else get(str2num(handles.edit2,'string')) && get(handles.checkbox2,'value')==1
end
Rik
Rik 2018년 7월 27일
I don't understand what you are trying to achieve with the first part of you if statement. I think you need to swap get and str2num.

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

답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by