How to do a rem while loop?
2 views (last 30 days)
Show older comments
Hello everyone. I need the h value to be an integer, I can't have decimals. Therefore, I think a while loop with the function rem is needed but I have no idea how to do it.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/442238/image.png)
0 Comments
Answers (1)
Walter Roberson
on 3 Dec 2020
while true
h = input('Enter the desired grid spacing: ');
if isnumeric(h) && isscalar(h) && h > 0 && rem(h,1) == 0; break; end
end
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements 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!