Check Model Compliance Using Edit-Time Checking
When you enable edit-time checks, the Model Advisor evaluates the model against a subset of Model Advisor checks. Highlighted blocks in the model editor window alert you to issues in your model. This enables you to identify modeling issues earlier in the model design process.
Configure Your Model to Use Edit-Time Checking
You can use one of these methods to enable edit-time checking of your model:
In the Debug tab, select Diagnostics > Edit-Time Checks. The Configuration Parameters dialog box opens and you select the check box for Edit-Time Checks.
In the Modeling tab, select Model Advisor > Edit-Time Checks. The Configuration Parameters dialog box opens and you select the check box for Edit-Time Checks.
Enable edit-time checking through the command line using the
edittime.setAdvisorChecking
function.If you have an Embedded Coder® or Simulink® Coder™ license, you can use edit-time checks to evaluate your model for issues that are specific to code generation. To enable these checks, open the Embedded Coder (Embedded Coder) app and select the C/C++ Code Advisor > Edit-Time Checks. The Configuration Parameters dialog box opens and you select the check box for Edit-Time Checks.
When edit-time checking is enabled, the Model Advisor highlights blocks in your model that violate Model Advisor checks.
If you edit the model when edit-time checking is enabled, the Model Advisor checks out a Simulink Check™ license.
To review a check violation, click the error or warning icon above the highlighted block. A diagnostics window opens, which provides information about the modeling issue that violates the Model Advisor check. When a block violates multiple checks, you can use the diagnostics window to review issues.
For each modeling issue, you can use the diagnostics window to:
Review the cause and explore suggested options for fixing the issue, if any.
Click the question mark to access detailed documentation about the violated Model Advisor check.
Add a justification for the violation by clicking Suppress.
In this example, you use edit-time checking to verify the compliance of a model with MAB guidelines while you edit.
Open a model. For this example, open the model
sldemo_fuelsys
by typing this command in the MATLAB command prompt:openExample('sldemo_fuelsys')
To enable the edit-time checking, in the Modeling tab, select Model Advisor > Edit-Time Checks. The Configuration Parameters dialog box opens and you select the check box for Edit-Time Checks.
The Model Advisor highlights several blocks. Place your cursor over the warning of the Throttle Angle Fault Switch block to discover the issue.
Select the warning. The Model Advisor indicates that the block name has an incorrect character. Replace the space with an underscore character and the warning goes away.