How can i determine error in matlab by using error loop without try catch or other loops?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ahmet ozdemir
el 30 de Abr. de 2016
Respondida: ahmet ozdemir
el 30 de Abr. de 2016
My code only includes numbers. If someone donot gives a numbers in input, this code shows screen like ERROR but code should continue to work Thanks,
0 comentarios
Respuesta aceptada
Azzi Abdelmalek
el 30 de Abr. de 2016
Editada: Azzi Abdelmalek
el 30 de Abr. de 2016
a=input('enter a number N','s')
b=str2num(a)
if isempty(b)
'Error'
'presse any key to cotinue'
pause
end
1 comentario
Walter Roberson
el 30 de Abr. de 2016
Editada: Walter Roberson
el 30 de Abr. de 2016
str2double would be better for restricting to numbers. you would check for nan rather than isempty
Más respuestas (1)
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!