When we run this script (by typing in buggy
at the MATLAB prompt), this
is what happens:
MATLAB is trying to tell us that there is a bug (an error) in our script buggy.m
.
MATLAB even tells us where it thinks the error is: Line 4, Column 7.
Let's look there:
Sure enough, there is an error: an extra * at the end of the line. MATLAB does not like extra asterisks hanging around. Note that even though the error does not occur until Line 4, none of the lines in the buggy.m script produce any output.
After we edit buggy.m
to remove that extra asterisk at the end of Line 4,
then we run buggy.m
again, with these results:
Take-home lesson: bugs in MATLAB scripts often suppress output entirely, so carefully check your code for errors. Alternatively, you can comment out the buggy line(s) and rerun your code.