Main Content

db_0127: Limitation on MATLAB commands in Stateflow blocks

Since R2020a

Guideline Publication

Control Algorithm Modeling Guidelines - Using MATLAB®, Simulink®, and Stateflow®

Sub ID Recommendations

  • NA-MAAB — a1/a2

  • JMAAB — a1/a2

MATLAB Versions

All

Rule

Sub ID a1

MATLAB commands shall not be used in Stateflow blocks.

Custom Parameter

Not Applicable

Example — Correct

MATLAB commands are not used in Stateflow blocks.

Example — Incorrect

A MATLAB command is used in the Stateflow block.

Sub ID a2

When a MATLAB command is used in Stateflow blocks, it shall be accessed only by using MATLAB Function block.

Custom Parameter

Not Applicable

Example — Correct

The MATLAB command is accessed by using the MATLAB Function block.

Example — Incorrect

A MATLAB Function block is not used for a MATLAB command.

Rationale

Sub ID a1:

  • Not all MATLAB commands are supported for code generation. As a result, code may not be generated for these unsupported MATLAB commands.

Sub ID a2:

  • Not all MATLAB commands are supported for code generation. As a result, code may not be generated for these unsupported MATLAB commands.

  • Readability improves when C and MATLAB action languages are described separately.

Verification

Model Advisor check: Check for MATLAB expressions in Stateflow charts (Simulink Check)

Last Changed

R2020a

Version History

Introduced in R2020a