How to error check a string for numbers?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
KSSV
il 15 Ott 2018
name = input('Please enter your name:\n', 's');
if isnan(str2double(name))
fprintf('Input is a string\n')
end
Vedere anche
Categorie
Scopri di più su Characters and Strings in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!