How to run a loop with isNaN
Show older comments
How would i make a loop where if a positive number isnt inputted, The question is asked again?
4 Comments
Jan
on 17 Oct 2022
This sounds like a homework assignment. What have you tried so far? Which explicit problem to you have?
Davide Masiello
on 17 Oct 2022
Edited: Davide Masiello
on 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
on 17 Oct 2022
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!