Check usage of character vector inside MATLAB Function block
Guideline: na_0021: Strings in MATLAB® functions
Identifies character vectors that are used in MATLAB Function blocks.
MATLAB Functions store strings as character arrays. Due to lack of dynamic memory allocation, the arrays cannot be re-sized to accommodate a string value of different length. Strings are not a supported data type in Simulink®, so MATLAB Function blocks cannot pass the string data outside the block.
This check requires a Simulink Check™ license.
This check does not include sub-checks because the MAB modeling guideline provides only one sub ID.
For reference, the MAB guideline sub ID(s) that are recommended for use by the NA-MAAB and JMAAB modeling standards organizations are:
NA-MAAB — a
JMAAB — a
You can use Model Advisor Configuration Editor to configure this check
to include files with a
.m extension in the analysis. To enable this
feature, in the Input Parameters section, select Check
external .m files referenced in the model.
Results and Recommended Actions
|MATLAB Function block contains a character vector.||Consider using enumerations instead of character vectors.|
Capabilities and Limitations
This check does flags direct string substitutions only.
Does not flag strings in MATLAB
Does not flag character vectors that are hard-coded into the class definition.
Runs on library models.
Analyzes content in masked subsystems. By default, the input parameter Look under masks is set to
Analyzes content of library-linked blocks. By default, the input parameter Follow links is set to