How to error check a string for numbers?
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
KSSV
el 15 de Oct. de 2018
name = input('Please enter your name:\n', 's');
if isnan(str2double(name))
fprintf('Input is a string\n')
end
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!