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에서 Hypothesis Tests에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!