How to run a loop with isNaN
Afficher commentaires plus anciens
How would i make a loop where if a positive number isnt inputted, The question is asked again?
4 commentaires
Jan
le 17 Oct 2022
This sounds like a homework assignment. What have you tried so far? Which explicit problem to you have?
Davide Masiello
le 17 Oct 2022
Modifié(e) : Davide Masiello
le 17 Oct 2022
Your code seems fine, just remove the line
a =~ NaN;
and it works, meaning that if you input a = nan then it'll display the 'Please only enter a numerical value for a: ' message.
Benjamin
le 17 Oct 2022
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!