Move to next selection

1 visualizzazione (ultimi 30 giorni)
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.

Risposta accettata

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH il 6 Dic 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

Più risposte (0)

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by