Move to next selection

2 vues (au cours des 30 derniers jours)
Matthew Perry
Matthew Perry le 6 Déc 2019
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.

Réponse acceptée

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH le 6 Déc 2019
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

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by