Main Content

jc_0231: Usable characters for block names

Since R2020a

Guideline Publication

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

Sub ID Recommendations

  • NA-MAAB — a, b, c, d, e, f

  • JMAAB — a, b, c, d, e, f

MATLAB Versions

All

Rule

Sub ID a

Only these character types shall be used for basic block names:

  • Single-byte alphanumeric characters (a-z, A-Z, 0-9)

  • Single-byte underscore (_)

Line breaks and single-byte spaces shall not be permitted when adding a new block name. However, they shall be permitted when used initially as a block name that is saved in the Simulink library.

Double-byte characters and control characters shall not be used.

Exception

Inport and Outport blocks

Custom Parameter

Not Applicable

Example — Correct

Block names are registered in the Simulink library.

Example — Incorrect

Single-byte spaces, double-byte characters, and symbol characters are used.

Sub ID b

Basic block names shall not use numbers at the beginning.

Exception

Inport and Outport blocks

Custom Parameter

Not Applicable

Example — Incorrect

Sub ID c

Basic block names shall not use underscores at the beginning.

Exception

Inport and Outport blocks

Custom Parameter

Not Applicable

Example — Incorrect

Sub ID d

Basic block names shall not use underscores at the end.

Exception

Inport and Outport blocks

Custom Parameter

Not Applicable

Example — Incorrect

Sub ID e

Basic block names shall not use consecutive underscores.

Exception

Inport and Outport blocks

Custom Parameter

Not Applicable

Example — Incorrect

Sub ID f

Basic block names shall not consist solely of a single reserved MATLAB word.

Exception

Inport and Outport blocks

Custom Parameter

Not Applicable

Example — Incorrect

Rationale

Sub IDs a, b:

  • Deviation from the rule can make it difficult to maintain the integrity of the model and code.

Sub IDs c, e:

  • Readability is impaired.

Sub IDs d:

  • Readability is impaired.

  • Underscores can be used to separate words. However, they are typically used as word breaks and can cause misunderstanding in the description.

Sub IDs f:

  • Readability is impaired.

  • Deviation from the rule can cause unexpected issues.

Verification

Model Advisor check: Check character usage in block names (Simulink Check)

Last Changed

R2020a

See Also

Version History

Introduced in R2020a