Check array indices
Check ID:
mathworks.jmaab_v6.mp_0046
Guideline: mp_0046: Method of describing array indices
Description
Checks whether expressions are used to calculate array indices.
The following cases are allowed.
Use of the colon operator,
:
.Addition or subtraction carried out on the last element of an array represented by the
end
keyword.
This check applies to array indices in the following target components:
MATLAB® function blocks in Simulink®.
MATLAB functions in Stateflow® charts.
States, transitions, and truth tables in Stateflow MATLAB charts.
External MATLAB files referenced in a model.
This check requires a Simulink Check™ license.
Check Parameterization
This check does not include sub-checks because the JMAAB modeling guideline provides only one sub ID.
For reference, the guideline sub ID(s) that are recommended for use by the JMAAB modeling standards organizations are:
JMAAB — a
Select Check external .m files referenced in the
model, to include .m
files referenced by a model in
the analysis. The check box is selected by default.
Results and Recommended Actions
Condition | Recommended Action |
---|---|
One or more array indices are calculated using expressions. | Rewrite array indices to avoid using expressions other than the use
of the colon operator and adding or subtracting from
end . |
Capabilities and Limitations
Analyzes content of library-linked blocks. By default, the input parameter Follow links is set to
on
.Analyzes content in masked subsystems. By default, the input parameter Look under masks is set to
all
.Runs on library models.
Allows exclusion of blocks and charts.