You can change how Code Analyzer messages appear in the Editor and Live Editor. With a few exceptions, these preferences apply to messages in the Editor, Live Editor, MATLAB® Function Block Editor (if your products use that tool), and Code Analyzer Report.
On the Home tab, in the Environment section, click Preferences. Select Code Analyzer, and then adjust preference options as described in the table below.
|Enabled Integrated Warning and Error Messages|
Specify whether you want to display Code Analyzer message indicators, such as the underlining of code and the message indicator bar, for documents open in the Editor.
For more information, see Automatically Check Code in the Editor and Live Editor — Code Analyzer.
Specify the type of coding issues that you want to have underlined.
Regardless of the underlining menu option you choose, the Editor marks errors and warnings in the message indicator bar.
Provides a link to a preference panel that enables you to adjust the color highlighting errors and warnings that MATLAB can autofix. You trigger autofix by clicking the Fix button in a Code Analyzer message.
Select the set of message settings to use. Click the down arrow to select or browse to a previously saved settings file.
Click to open a menu that enables you to select:
Searches the list of Code Analyzer messages that display below the search field. For details, see Search for Messages in the Code Analyzer Preferences.
Code Analyzer message settings
Select or clear messages to enable or suppress their appearance in your Editor documents.
To expand or collapse all categories in the list, right-click anywhere in the list and select Expand All or Collapse All.
To suppress a message on a line-by-line or file-by-file basis, see Adjust Code Analyzer Message Indicators and Messages.
You can search the list of Code Analyzer messages in the Code Analyzer preferences to display only those messages that are currently of interest to you. Use any combination of the methods that the following table presents.
If you do not have the MATLAB Compiler™ installed, the Code Analyzer preferences pane does not display the MATLAB Compiler (deployment) messages category.
|To See a List of Messages ...||Perform this action...||Example Scenario|
Containing specified text in the:
In MATLAB Online™, the extended message is not included in the search.
Type the text in the search field.
You recall seeing a message containing some text that you want to review, but you cannot remember the exact message text.
For example, type
Corresponding to a given message ID
You are reviewing the code that someone else wrote and you
want to see the message that corresponds to a suppressed one
Not all Code Analyzer messages have additional information. These messages do not appear as links.
That you can set using Code Analyzer preferences
Click the down arrow to the right of the search field, and then click Show All.
You want to see the complete list of messages after you have searched the messages for some text or a given search menu option.
Different from the default setting (of enabled or disabled)
Click the down arrow to the right of the search field, and then click Show Messages Modified from Default.
A gray dot precedes a message with a setting different from the default. For example:
A coworker gave you a settings file and you want to review each message that the coworker changed from its default setting.
In a given category
Click the down arrow to the right of the search field, click Show Messages in Category, and then click the category you want.
You want to review messages that describe coding practices that make it difficult for others to use your code.
Click the down arrow to the right of the search field, select Show Messages in Category, and then select Aesthetics and Readability.
Click the messages that appear as links for more information. Not all messages appear as links.
That are warnings
Click the down arrow to the right of the search field, and then select Show All Warnings. An exclamation point in a yellow triangle indicates a warning message.
You recall previous warnings that your code generated, but you cannot remember enough details to use the search field to find it. You want to skim all the warning messages to find a particular one of interest.
Click the down arrow to the right of the search field, and then select Show All Errors. By default, an X in a red dot indicates an error message, .
You want to find a message elicited by a script you worked
on previously. All you can recall is that it was an error and it
Click the down
arrow to the right of the search field, and then select
Show All Errors. Then, type a
The Code Analyzer preference pane displays only
error messages that contain the word
Click the down arrow to the right of the search field, and then select Show Disabled Messages.
You want to see the messages that are disabled by default or you have previously disabled.
To display Code Analyzer error messages that contain the word
variable and are disabled:
Click the down arrow in the search field, and then select Show All Errors.
The search field contains
At the end of the text
press the Space key, and then type
Click the down arrow in the search field and select Show Disabled Messages.
The search field now contains
enabled:false. Only the messages that fulfill those requirements
appear in the Preferences pane. To restore the list of all messages, click the
clear search button .
The Show All Errors and Show Disabled Messages options are not available in MATLAB Online.