NA-MAAB — a
JMAAB — a
Assignment statements for strings shall not be used in MATLAB® functions.
An assignment statement for strings is being used in the MATLAB function.
function y = fcn(u) %#codegen str = 'A'; for i = 1:u str = [str 'B']; end if strcmp(str, 'ABB') y = int16(1); else y = int16(0); end end
Sub ID a:
MATLAB functions store strings as character arrays. As a result, storing strings of different lengths in the same variable does not support dynamic memory allocation, which prevents the strings from being stored.
Consider using enumerated types when a string is used in a Switch Case block
Model Advisor check: Check usage of character vector inside MATLAB Function block (Simulink Check)
JMAAB guideline na_0021, which is available in Control Algorithm Modeling Guidelines Using MATLAB, Simulink, and Stateflow on the MathWorks® website.
Program a MATLAB Function in a Chart (Stateflow)