If there are two messages on a line that you do not want to display anywhere in the
current file, right-click separately at each underline, and then select the appropriate entry
from the context menu. The %#ok syntax expands. For the example, in the code presented
in “Check Code for Errors and Warnings” on page 24-6, ignoring both messages for line
49 adds %#ok<NBRAK,NOPRT>.
Even if Code Analyzer preferences are set to enable this message, the message does not
appear because the %#ok takes precedence over the preference setting. If you later
decide you want to check for a terminating semicolon in the file, delete %#ok<*NOPRT>
from the line.
Suppress All Instances of a Message in All Files
You can disable all instances of a Code Analyzer message in all files. For example, using
the code presented in “Check Code for Errors and Warnings” on page 24-6, follow these
steps:
(^1) In line 49, right-click at the first underline (for a single-button mouse, press Ctrl
+click).
(^2) From the context menu, select Suppress 'Terminate statement with semicolon...'
In All Files.
This modifies the Code Analyzer preference setting.
If you know which message or messages you want to suppress, you can disable them
directly using Code Analyzer preferences, as follows:
1
On the Home tab, in the Environment section, click Preferences.
(^2) Select MATLAB > Code Analyzer.
(^3) Search the messages to find the ones you want to suppress.
(^4) Clear the check box associated with each message you want to suppress in all files.
(^5) Click OK.
Save and Reuse Code Analyzer Message Settings
You can specify that you want certain Code Analyzer messages enabled or disabled, and
then save those settings to a file. When you want to use a settings file with a particular
file, you select it from the Code Analyzer preferences pane. That setting file remains in
effect until you select another settings file. Typically, you change the settings file when
you have a subset of files for which you want to use a particular settings file.
Check Code for Errors and Warnings