필터 지우기
필터 지우기

How to solve this problem [Output argument 'fever' is not assigned on some execution paths]?

조회 수: 3 (최근 30일)
I've been in this problem almost three months. I don't know what to do anymore.
I just want the output to display according to the condition given. If y > 3.74, display the value of fever. If y < 3.74, display the value of notfever. But because of the errors, I cannot proceed.
It is an honoured if anybody could help me to solve this error. here I attach the code that I'm used in Matlab function block.
function [fever,notfever] = detection(y)
if y > 37.4
fever = y;
else y < 37.4
notfever = y;
end
end

채택된 답변

Walter Roberson
Walter Roberson 2016년 10월 5일
In your code, what should be assigned to fever if y is not > 37.4 ? What should be assigned to notfever if y is not < 37.4?
Your code has to be written to assign something to each of the output variables. Even if it ends up looking like
function [fever,notfever] = detection(y)
if y > 37.4
fever = y;
notfever = inf;
else y < 37.4
notfever = y;
fever = inf;
else
fever = inf;
notfever = inf;
end
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Biological and Health Sciences에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by