how to put a limited value for an input ?
1 次查看(过去 30 天)
显示 更早的评论
how to put a limited value for an input ? for example from (0 to 100) and if the user enter a value out of this range it will be invalid input ?
0 个评论
采纳的回答
Azzi Abdelmalek
2013-3-29
test=0
while test==0
a=input('enter 0<a<100')
if a>0 & a<100
test=1
end
end
6 个评论
Azzi Abdelmalek
2013-3-29
add this
if or(min(a)<0, max(a)>100)
display('Error, all values of a should be between 0 and 100')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NaNs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!