Repeating a code I have created

2 vues (au cours des 30 derniers jours)
danny walker
danny walker le 4 Mai 2021
Commenté : danny walker le 4 Mai 2021
Hi,
I am fairly new to matlab so please be kind.
I have created a code which is similar to the way the lottery works in that you can have a luckydip or select your own numbers and then it will create ranom numbers and match yours to it to see if you have won.
Now that all works correctly but at the end of it I would like to give the user the oppurtunity to play again and start from the beginning of the code.
How do I go about doing this?
Thanks

Réponse acceptée

Mohammad Hussein Yoosefian Nooshabadi
Hi there!
There are several ways to do so. For instance, you can make your code loop until a particular character (for example "q") is entered by the user (using a while loop). But, to make it more fancy, I recommend using
questdlg
which pops up a menu from which the user can choose whether to continue playing or to exit. here is the documentation.
Good luck!
  1 commentaire
danny walker
danny walker le 4 Mai 2021
That works great, thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur App Building dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by