Help on while loop to make user enter an accepted value
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I need to have the user enter a number between 0 and 100, and have a while loop that prompts them to re-enter the value if they input one that is not valid.
using this format I can only make it work in the reverse of what I need
pC = input('enter initial volume of water, in percent of total tank capacity:','s')
while ((pC<0)&(pC>100))
if (pC>=0)&(pC<=100)
pC
else input('enter initial volume of water, in percent of total tank capacity:','s')
end
end
any advice would be greatly appreciated
0 Kommentare
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox 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!