Main Content

Check MATLAB Code Analyzer messages

Check ID: mathworks.hism.himl_0004

Check MATLAB® Functions for %#codegen directive, MATLAB Code Analyzer messages, and justification message IDs.

Description

Verifies %#codegen directive, MATLAB Code Analyzer messages, and justification message IDs for:

  • MATLAB code in MATLAB Function blocks

  • MATLAB functions defined in Stateflow® charts

  • Called MATLAB functions

Available with Simulink® Check™.

Results and Recommended Actions

ConditionRecommended Action

For MATLAB code in MATLAB Function blocks, either of the following:

  • Code lines are not justified with a %#ok comment.

  • Codes lines justified with %#ok do not specify a message id.

  • Implement MATLAB Code Analyzer recommendations.

  • Justify not following MATLAB Code Analyzer recommendations with a %#ok comment.

  • Specify justified code lines with a message id. For example, %#ok<NOPRT>.

For MATLAB functions defined in Stateflow charts, either of the following:

  • Code lines are not justified with a %#ok comment.

  • Codes lines justified with %#ok do not specify a message id.

  • Implement MATLAB Code Analyzer recommendations.

  • Justify not following MATLAB Code Analyzer recommendations with a %#ok comment.

  • Specify justified code lines with a message id. For example, %#ok<NOPRT>.

For called MATLAB functions:

  • Code does not have the %#codegen directive.

  • Code lines are not justified with a %#ok comment.

  • Codes lines justified with %#ok do not specify a message id.

  • Insert %#codegen directive in the MATLAB code.

  • Implement MATLAB Code Analyzer recommendations.

  • Justify not following MATLAB Code Analyzer recommendations with a %#ok comment.

  • Specify justified code lines with a message id. For example, %#ok<NOPRT>.

Capabilities and Limitations

  • This check only analyzes the functions that are directly referenced by the Simulink model.

  • Runs on library models.

  • Analyzes content of library-linked blocks. By default, the input parameter Follow links is set to on.

  • Analyzes content in masked subsystems. By default, the input parameter Look under masks is set to all.

  • Allows exclusions of blocks or charts.

See Also