Main Content
mp_0011: Method of inserting a single-width space
Since R2024b
Guideline Publication
Control Algorithm Modeling Guidelines - Using MATLAB®, Simulink®, and Stateflow®
Sub ID Recommendations
NA-MAAB — a
JMAAB — a
MATLAB Versions
All
Rule
Sub ID a
At least one space shall be inserted before and after operators and after commas.
Single-byte spaces shall not be inserted between unary operators and operands.
Example — Correct
foo = bar + baz; strcmp(qux, 'AEIOU')
x = -baz;
Example — Incorrect
foo=bar+baz; strcmp(qux, 'AEIOU')
x = - baz;
Rationale
Sub ID a:
The proper use of spaces around operators and commas can improve readability.
Verification
Model Advisor check: Check spaces in expressions (Simulink Check)
Last Changed
R2024b
Version History
Introduced in R2024b