Question about user input error
이전 댓글 표시
I have a simple piece of code that requires the input of a number. I want to prevent the user from accidentally enters a letter. I tried a while loop using intnan, but I'm stuck.
답변 (1개)
John BG
2016년 1월 29일
0 개 추천
try converting all inputs with uint.
If the return value of any input character does not belong to uint64('0123456789') then reject it, show a message or whatever you want to do.
John
카테고리
도움말 센터 및 File Exchange에서 Parallel Computing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!