jc_0736: Uniform indentations in Stateflow blocks
Guideline Publication
Control Algorithm Modeling Guidelines - Using MATLAB®, Simulink®, and Stateflow®
Sub ID Recommendations
NA-MAAB — No recommendations
JMAAB — a, b, c
MATLAB Versions
All
Rule
Sub ID a
State action types shall not have blank spaces at the start of a line.
Executable statements shall have one single-byte space at the start of the line.
Number of single-byte spaces
Executable statements use one single-byte space at the start of the line.

Executable statements do not have a single-byte space at the start of the line.

Sub ID b
A blank space shall not be entered before the following:
[of a transition condition{of a condition action/of a transition action
Not Applicable
A blank space is not entered before the [ and
{ of the transition label condition, condition action,
and transition action.

A blank space is entered before the [ and
{ of the transition label condition, condition action,
and transition action.

Sub ID c
At least one single-byte space shall be entered after the / of
a transition action.
Number of single-byte spaces
Single-byte spaces are entered after the / of the
transition action.

There are no single-byte spaces after the
/ of the transition action.

Rationale
Sub ID a:
Using uniform indents before the executable statement clarifies the link between the state action type of a state label and the execution statement, improving readability.
Sub ID b:
Using uniform indents for transition conditions, condition actions, and transition actions improves readability.
Sub ID c:
Consistent use of blank spaces improves readability.
Verification
Model Advisor check: Check indentation of code in Stateflow states (Simulink Check)
Last Changed
R2020a
See Also
Transition Between Operating Modes (Stateflow)
Version History
Introduced in R2020a