Main Content

Check spaces in expressions

Check ID: mathworks.jmaab_v6.mp_0011

Guideline: mp_0011: Method of inserting one single-byte space

Description

Checks if expressions have a space before and after binary operators and after commas, and no space between unary operators and operands.

This check applies to the following target components:

  • MATLAB Function blocks in Simulink®.

  • Embedded MATLAB® functions in Stateflow® charts.

  • States and transition labels in Stateflow charts.

  • External MATLAB files referenced in a model.

Following are the unary operators the check verifies:

  • TRANS (conjugate transpose, or ')

  • DOTTRANS (transpose, or .')

  • NOT (logical ~)

  • UMINUS (unary minus)

  • UPLUS (unary plus)

Following are the binary operators the check verifies:

  • 'EQUALS'

  • 'PLUS'

  • 'MINUS'

  • 'MUL'

  • 'DIV'

  • 'LDIV'

  • 'EXP'

  • 'DOT'

  • 'AND'

  • 'OR'

  • 'LT'

  • 'GT'

  • 'DOTMUL'

  • 'DOTDIV'

  • 'DOTLDIV'

  • 'DOTLP',

  • ANDAND'

  • 'OROR'

  • 'LE'

  • 'GE'

  • 'EQ'

  • 'NE'

  • 'DOTEXP'

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 files with a .m extension in the analysis. The check box is selected by default.

Results and Recommended Actions

ConditionRecommended Action
One or more expressions do not have a space before or after binary operators or after commas, or have spaces between unary operators and operands.Include a space before and after binary operators and after commas. Remove spaces between unary operators and operands.

Capabilities and Limitations

  • Excludes the colon operator from analysis.

  • Does not support exclusions of external MATLAB files.

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