Output argument 'x' is not assigned on some execution paths.

12 views (last 30 days)
hello guys,i have a problem with matlab, i created an embedded function and when i start simulation i get this error message"Output argument 'x' is not assigned on some execution paths." .I'm using while loop and "if" in the embedded function,i don't know what's wrong, waiting for your help thanks.
  2 Comments
Geoff Hayes
Geoff Hayes on 30 Apr 2014
At what point is your output variable x assigned to something? Is it within the if statement that you mention? If so, then when the if condition evaluates to false, your x will not be assigned to anything. Is this expected? I think that you have two choices - either initialize x to be an empty vector/matrix before entering the while loop (i.e. x=[];) in which case whomever calls this embedded function will have to realize that the output may be returned as empty, or review your code and determine how - under all conditions - should x be assigned.

Sign in to comment.

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!