How to solve this problem [Output argument 'fever' is not assigned on some execution paths]?
1 次查看(过去 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
0 个评论
采纳的回答
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 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!