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 — a, b

  • JMAAB — a, b

MATLAB Versions

All

Rule

Sub ID a

Built-in MATLAB functions shall not be used in Stateflow blocks.

Supplement

Applicable for C charts

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 b

When a built-in MATLAB function is used in Stateflow blocks, it shall be accessed only by using MATLAB Function.

Supplement

Applicable for C charts

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 a:

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

Sub ID b:

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

  • 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

R2024b

Version History

Introduced in R2020a