Why do I receive an error message about output arguments for my Embedded MATLAB Function in Simulink?

3 ビュー (過去 30 日間)
I have if-else statements in my code to output different results in different situations. When I start the simulation I get the following error message.. I hope you can help me. Thank you
Output argument 'D' is not assigned on some execution paths.
Function 'MPPT /IC Algo' (#182.9.10), line 1, column 10: "D"
function D = InCon(V,I,T)
  2 件のコメント
Honglei Chen
Honglei Chen 2018 年 6 月 6 日
The error message suggests that your D is not assigned for certain input combination. without the code itself, it would be hard for people to provide useful suggestions.
manash mishra
manash mishra 2018 年 6 月 8 日
ok, I am attaching the coding file. Thank you

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

回答 (2 件)

Birdman
Birdman 2018 年 6 月 8 日
Simulink wants to know the initial value and size of your output at the very beginning of the simulation. Therefore, add
D=0;
statement to your function at the very beginning. Then, it should work without error.
  3 件のコメント
Birdman
Birdman 2018 年 6 月 9 日
Then check your if-else statements and make sure that they are being entered because your value should have changed.

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


Honglei Chen
Honglei Chen 2018 年 6 月 8 日
Your D is undefined for the cases where T<=n*0.005
You can consider add that by adding the else branch to the code, for example,
if T>n*0.005
... % what you have now
else
D = Dold;
end
HTH
  2 件のコメント
manash mishra
manash mishra 2018 年 6 月 9 日
Thank you for your answer,but it doesn't work properly. same error
Shreyas H R
Shreyas H R 2018 年 7 月 24 日
i am facing the same error, if you have got any solution related to this, please do share me. shreyasacharya05@gmail.com

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

カテゴリ

Help Center および File ExchangeWord games についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by