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?
2 件のコメント
madhan ravi
2018 年 10 月 15 日
What should be the error check ,an example?
PJ
2018 年 10 月 15 日
回答 (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!