What is wrong with this if-elseif-else function
21 次查看(过去 30 天)
显示 更早的评论
what is wrong with it
0 个评论
采纳的回答
James Tursa
2017-9-22
编辑:James Tursa
2017-9-22
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!