필터 지우기
필터 지우기

Move to next selection

조회 수: 2 (최근 30일)
Matthew Perry
Matthew Perry 2019년 12월 6일
답변: JESUS DAVID ARIZA ROYETH 2019년 12월 6일
hi all, I am wanting matlab to move to the next multi choice question if the chosen answer is "No"
eg:
choice = menu("Do you want to see the opening times of this recycling centre?","Yes","No")
if choice == 1
new_data(selectedplaceindex,1:3)
elseif choice == 2
%THIS IS THE LINE i STRUGGLE WITH
end
choice2 = menu("Do you want to navigate there?","Yes","No")
if choice2 == 1
new_data(selectedplaceindex,4)
elseif choice2 == 2
menu("Thank you, keep recycling!")
end
this is the selection process I want however, after "choice" is chosen, if "choice == 2" i want matlab to forget that selection and move on. equally with choice ==1 but i think that works anyway.

채택된 답변

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2019년 12월 6일
so you don't need to place an else in the first:
choice = menu("Do you want to see the opening times of this recycling centre?","Yes","No")
if choice == 1
new_data(selectedplaceindex,1:3)
end
choice2 = menu("Do you want to navigate there?","Yes","No")
if choice2 == 1
new_data(selectedplaceindex,4)
elseif choice2 == 2
menu("Thank you, keep recycling!")
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by