Output Argument Not Assigned During Call

5 views (last 30 days)
Andrew
Andrew on 23 Jul 2012
Hello,
I'm in the process of writing some code that calls on a commonly used function which was written by someone else. The problem is that I keep getting the following error message:
??? Output argument "G1" (and maybe others) not assigned during call to
"/MATLAB/Working_Paper_1/gensys.m>gensys".
This "G1" is the first output argument and, as far as I can see, it is assigning a value to it within the function. Nothing related to this output argument is commented out and everything looks like it should work, but it doesn't. Is there anything that could cause this error message that I'm just not seeing or thinking about?
The link to the code is here:
Thanks for the help,
Andrew

Answers (1)

Jan
Jan on 23 Jul 2012
Edited: Jan on 23 Jul 2012
When the zxz flag is set in gensys(), this function return pre-maturely without defining G1. Unfortunately the corresponding warning message has been disabled. A proper message had saved some of your time.
You can check this by either by using the debugger:
dbstop if error
Then Matlab stops, when the error occurs and you can check the reasons. Or set a break point in the code and step through the program until it returns.
Btw. the program is ugly. Useless lines like
div ;
nunstab;
where div and nunstab are variaables, are useful to increase the confusion and waste time only. Overwriting the built-in function exist is a bad idea also. The massive use of commented code is not helpful: Nobody will remove the comment charatcters ever, such that deleting the lines is more useful.

Categories

Find more on Debugging and Analysis 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!