NA-MAAB — No recommendations
JMAAB — a, b1/b2/b3, c
All
When Stateflow®
Chart (Stateflow) property Action Language is set to
C
, operators (&
, |
,
^
, ~
) shall be used only for bit operations.
Not Applicable
Operators (&
, |
, ^
,
~
) are used for bit operations.
Operators (&
, |
, ^
,
~
) are not used for bit operations.
When Stateflow
Chart (Stateflow) property Action Language is set to
C
, operator ~=
shall be used for inequality
operations.
Not Applicable
When Stateflow
Chart (Stateflow) property Action Language is set to
C
, operator !=
shall be used for inequality
operations.
Not Applicable
When Stateflow
Chart (Stateflow) property Action Language is set to
C
, operator <>
shall be used for inequality
operations.
Not Applicable
When Stateflow
Chart (Stateflow) property Action Language is set to
C
, operation !
shall be used for logical negation.
Not Applicable
An operator other than !
should be used for logical negation.
Sub ID a:
When either of these Stateflow Chart properties are set as follows:
Action Language is set to MATLAB
Action Language is set to C
and
Enable C-Bit
Operations (Stateflow) is selected
&&
and &
,
||
,and |
, have the same calculation function. However,
when &&
and &
or ||
and
|
are combined in the same chart, it can be difficult to determine whether
these are separate calculation functions or the same calculation function.
Sub IDs b1, b2, b3:
Consistent use of equality operators improves readability.
Sub ID c:
Consistent use of logical negation operators improves readability.
When C-bit operations are enabled is selected, the function
of the !
operator remains the same and is not affected by logic changes
that result from changing the setting.
Model Advisor check: Check Stateflow operators (Simulink Check)
R2020a
JMAAB guideline na_0001, which is available in Control Algorithm Modeling Guidelines Using MATLAB, Simulink, and Stateflow on the MathWorks® website.
Modify the Action Language for a Chart (Stateflow)
Differences Between MATLAB and C as Action Language Syntax (Stateflow)