I have a big, complex MATLAB program. Somewhere within that, the number 0 is being emitted, so when I run it, I see this repeated a bunch of times:
ans =
0
That looks messy, so I want to get rid of it. Is there any easy way for me to figure out where that output is coming from?
A few options you have:
Open each of your scripts/functions in the MATLAB Editor, which will visually indicate where there are lines that are missing a terminating semicolon (assuming that warning isn’t suppressed in the Code Analyzer preferences). Note the orange squiggly line in this example function:
Use the function CHECKCODE (formerly MLINT) to find lines in your scripts/functions that are missing terminating semicolons. For the example function from above:
Use command echoing. This will print each line of code to the Command Window as it’s evaluated. Then all you have to do is look for the line preceding the unwanted output to find where you are missing a terminating semicolon. I would try typing one of these options at the command line:
Be forewarned… you will probably get a lot of output getting dumped to the Command Window with this option.