MATLAB Answers


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

Asked by manash mishra on 6 Jun 2018
Latest activity Commented on by Shreyas H R on 24 Jul 2018
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)


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.

Sign in to comment.

2 Answers

Answer by Birdman
on 8 Jun 2018

Simulink wants to know the initial value and size of your output at the very beginning of the simulation. Therefore, add
statement to your function at the very beginning. Then, it should work without error.


Thank you for your answer, it works properly.But the values of Dis zero always.
Then check your if-else statements and make sure that they are being entered because your value should have changed.

Sign in to comment.

Answer by Honglei Chen
on 8 Jun 2018

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
D = Dold;


Thank you for your answer,but it doesn't work properly. same error
i am facing the same error, if you have got any solution related to this, please do share me.

Sign in to comment.