Restart script when user says yes
Mostra commenti meno recenti
Hi,
I have a while statement at the end of my code asking if they would like to select another choice to repeat the code, however I cannot get it to begin from the beginning of the script again, and so just repeats itself.
My code:
function [m] = AnotherTeam
while(1)
m = input('Do you want to choose a different team, Y/N [Y]:','s');
if m == 'N'
break
elseif m == 'Y'
[team] = choose_team;
end
end
end
Is there a way to get this to restart the code from a specific point
Many thanks in advance for any feedback
2 Commenti
Geoff Hayes
il 11 Feb 2021
Jake - you may need to show more of your code so that we can get an idea of what you mean by ..begin ffom the beginning of the script again. What is the beginning? Outside of the while loop or somewhere else? If the user selects N then (from what I can see) you break out of the while loop. But where do you want to "go" if the user says Y.
Jake keogh
il 11 Feb 2021
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Scripts in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!