Programming |
|
Warning Control
MATLAB gives you the ability to control what happens when a warning is encountered during M-file program execution. Options that are available include
- Display selected warnings
- Ignore selected warnings
- Stop in the debugger when a warning is invoked
- Display an M-stack trace after a warning is invoked
Depending on how you set up your warning controls, you can have these actions affect all warnings in your code, specific warnings that you select, or just the most recently invoked warning.
Setting up this system of warning control involves several steps.
- Start by determining the scope of the control you will need for the warnings generated by your code. Do you want the above control operations to affect all the warnings in your code at once, or do you want to be able to control certain warnings separately?
- If the latter is true, you will need to identify those warnings you want to selectively control. This requires going through your code and attaching unique message identifiers to those warnings. If, on the other hand, you don't require that fine a granularity of control, then the warning statements in your code need no message identifiers.
- When you are ready to run your programs, use the MATLAB warning control statements to exercise the desired controls on all or selected warnings. Include message identifiers in these control statements when selecting specific warnings to act upon.
| Warnings | | Warning Statements | |
© 1994-2005 The MathWorks, Inc.