What is wrong with this if-elseif-else function
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Blair Hall
le 22 Sep 2017
Modifié(e) : James Tursa
le 22 Sep 2017
what is wrong with it
0 commentaires
Réponse acceptée
James Tursa
le 22 Sep 2017
Modifié(e) : James Tursa
le 22 Sep 2017
The main problem is this line
elseif( userWeight >= 50 )
should be this instead
elseif( userWeight <= 140 )
And then the remaining parts of the if-then-else aren't really needed. The way you have it coded now, if userWeight is 500 they will get a dosageAmount of 20 because they will match that second branch test.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Problem-Based Optimization Setup 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!