Output argument 't' is not assigned on some execution paths.
이전 댓글 표시
I use matlab function block in simulink and got tihs error. Not sure if it's my code or something because I've never use this function block before. Here is my code;
function t = fcn(tr, soc)
if(tr<=20)
if(soc<=0.25)
t=tr+5;
elseif(0.25<soc<=0.5)
t=0;
elseif(0.5>soc)
t=0;
end
elseif(20<tr<=30)
if(soc<=0.25)
t=tr+5;
elseif(0.25<soc<=0.5)
t=tr-5;
elseif(0.5>soc)
t=tr-10;
end
elseif(tr>30)
if(soc<=0.25)
t=tr+10;
elseif(0.25<soc<=0.5)
t=tr-10;
elseif(0.5>soc)
t=tr-0;
end
end
end
Thank you
채택된 답변
추가 답변 (1개)
KNourdine
2021년 11월 4일
0 개 추천
elseif(0.5>soc) should be elseif(0.5<soc)
카테고리
도움말 센터 및 File Exchange에서 Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!