Main Content

Check for usage of nonempty statements

Check ID: mathworks.jmaab_v6.mp_0047

Guideline: mp_0047: Conditions for nonempty statements to be satisfied

Description

Checks for nonempty statements that satisfy the following conditions.

  • Does not have one or more effects on the overall code.

  • Does not have the capability to change the control flow of a program.

Note

This check considers nonempty statements as statements that are not blank lines of code followed by a semicolon.

For example, the following statement does not have an impact on the code because a variable bar is compared to a number without saving the outcome for further use.

bar == 1;

This check applies to the following target components:

  • MATLAB Function blocks in Simulink®.

  • MATLAB® functions in Stateflow® charts.

  • States, transitions, and truth tables in Stateflow MATLAB charts.

  • External MATLAB files referenced in a model.

This check requires a Simulink Check™ license.

Check Parameterization

This check does not include sub-checks because the JMAAB modeling guideline provides only one sub ID.

For reference, the guideline sub ID(s) that are recommended for use by the JMAAB modeling standards organizations are:

  • JMAAB — a

Select Check external .m files referenced in the model, to include .m files referenced by a model in the analysis. The check box is selected by default.

Results and Recommended Actions

ConditionRecommended Action
One or more nonempty statements do not have an effect on the overall code or change the control flow of the program.Modify or remove the nonempty statements that do not have an effect on the overall code or change the control flow of the program.

Capabilities and Limitations

  • 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.

  • Runs on library models.

  • Allows exclusion of blocks and charts.