Programming |
Debug, Backtrace, and Verbose Modes
In addition to warning messages, there are three modes that can be enabled or disabled with a warning control statement. These modes are shown here.
The syntax for using this type of control statement is as follows, where state
, in this case, can be only on
, off
, or query
.
Note that there is no need to include a message identifier with this type of control statement. All enabled warnings are affected by the this type of control statement.
Example 1 -- Entering Debug Mode on a Specific Warning
To enter debug mode whenever a Simulink actionNotTaken
warning is invoked, first turn off all warnings and enable only this one type of warning using its message identifier. Then turn on debug mode for all enabled warnings. When you run your program, MATLAB will stop in debug mode just before this warning is executed. You will see the debug prompt (K>>
) displayed.
Example 2 -- Enabling Verbose Warnings
When you enable verbose warnings, MATLAB displays an extra line of information with each warning that tells you how to suppress it:
warning on verbose A = 25/0; Warning: Divide by zero. (Type "warning off MATLAB:divideByZero" to suppress this warning.)
Saving and Restoring State | Debugging Errors and Warnings |
© 1994-2005 The MathWorks, Inc.