For code generation, represent text as a character array or as a 1-by-1 string array (string scalar).
Encoding of Characters in Code Generation
Differences in character encoding between MATLAB® and code generation can result in errors or different answers.
Adhere to code generation restrictions for strings.
Choose how you want to specify string scalar inputs.
Generate C/C++ Strings from MATLAB Strings and Character Row Vectors
Generate C/C++ strings from null-terminated MATLAB strings and character vectors.