What is wrong with this if-elseif-else function
조회 수: 4 (최근 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!