Code Generation for Character Arrays

The code generator translates the 16-bit Unicode® encoding of a character in MATLAB® to an 8-bit encoding that the locale setting determines. The code generator does not support characters that require more than 1 byte in MATLAB. This restriction applies to character arrays that are passed between MATLAB and the code generator. For example, the restriction applies to entry-point function inputs and to outputs from extrinsic calls. For code generation, some MATLAB functions accept only 7-bit ASCII characters. See Functions and Objects Supported for C/C++ Code Generation — Alphabetical List.

If a character is not in the 7-bit ASCII codeset, casting the character to a numeric type, such as double, produces a different result in the generated code than in MATLAB. A best practice for code generation is to avoid performing arithmetic with characters.

More About

Was this topic helpful?