How to do a rem while loop?

1 Ansicht (letzte 30 Tage)
Hdez
Hdez am 3 Dez. 2020
Beantwortet: Walter Roberson am 3 Dez. 2020
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.

Antworten (1)

Walter Roberson
Walter Roberson am 3 Dez. 2020
while true
h = input('Enter the desired grid spacing: ');
if isnumeric(h) && isscalar(h) && h > 0 && rem(h,1) == 0; break; end
end

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by