How to error check a string for numbers?
이전 댓글 표시
So I have an input
name = input('Please enter your name:\n', 's');
How can I error check so that a user cannot enter any numbers for it?
답변 (1개)
KSSV
2018년 10월 15일
name = input('Please enter your name:\n', 's');
if isnan(str2double(name))
fprintf('Input is a string\n')
end
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!