(^4) Save the modified file(s).
(^5) Rerun the report to see if your changes addressed the issues noted in the
messages.
Adjust Code Analyzer Message Indicators and Messages
Depending on the stage at which you are in completing a MATLAB file, you might want to
restrict the code underlining. You can do this by using the Code Analyzer preference
referred to in step 1, in “Check Code for Errors and Warnings” on page 24-6. For
example, when first coding, you might prefer to underline only errors because warnings
would be distracting.
Code analysis does not provide perfect information about every situation and sometimes,
you might not want to change the code based on a message. If you do not want to change
the code, and you do not want to see the indicator and message for that line, suppress
them. For the lengthofline example, in line 49, the first message is Terminate
statement with semicolon to suppress output (in functions). Adding a
semicolon to the end of a statement suppresses output and is a common practice. Code
analysis alerts you to lines that produce output, but lack the terminating semicolon. If you
want to view output from line 49, do not add the semicolon as the message suggests.
There are a few different ways to suppress (turn off) the indicators for warning and error
messages:
- “Suppress an Instance of a Message in the Current File” on page 24-12
- “Suppress All Instances of a Message in the Current File” on page 24-12
- “Suppress All Instances of a Message in All Files” on page 24-13
- “Save and Reuse Code Analyzer Message Settings” on page 24-13
You cannot suppress error messages such as syntax errors. Therefore, instructions on
suppressing messages do not apply to those types of messages.
NoteChanging the Code Analyzer Message preferences is not supported in MATLAB
Online. All Code Analyzer messages are always enabled.
Check Code for Errors and Warnings