フィルターのクリア

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
  2 件のコメント
SyukriY
SyukriY 2016 年 10 月 5 日
Ok. I'll try it.
SyukriY
SyukriY 2016 年 10 月 5 日
It works! Problem solved. Thank you, Walter Roberson

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBiological and Health Sciences についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by