How to error check a string for numbers?
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
KSSV
am 15 Okt. 2018
name = input('Please enter your name:\n', 's');
if isnan(str2double(name))
fprintf('Input is a string\n')
end
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!