How can i determine error in matlab by using error loop without try catch or other loops?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
ahmet ozdemir
le 30 Avr 2016
Réponse apportée : ahmet ozdemir
le 30 Avr 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 commentaires
Réponse acceptée
Azzi Abdelmalek
le 30 Avr 2016
Modifié(e) : Azzi Abdelmalek
le 30 Avr 2016
a=input('enter a number N','s')
b=str2num(a)
if isempty(b)
'Error'
'presse any key to cotinue'
pause
end
1 commentaire
Walter Roberson
le 30 Avr 2016
Modifié(e) : Walter Roberson
le 30 Avr 2016
str2double would be better for restricting to numbers. you would check for nan rather than isempty
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!