codegen_emit_storage_c
coder · scripts/coder/codegen_emit_storage_c.m
CODEGEN_EMIT_STORAGE_C Emit C for MATLAB persistent/global (nexus#1709)
CTEXT = codegen_emit_storage_c (MSOURCE) returns a character vector of
C99 for a restricted scalar entry-point .m whose body uses persistent
and/or global variables.
Behaviour (MATLAB R2026a / MATLAB Coder standalone C):
persistent x -> static real_T x; inside the generated function
(plus static boolean_T x_not_empty when isempty is
used for first-call initialisation)
global g -> file-scope real_T g; (not function-local static)
MSOURCE is the .m source text (char / string / cellstr). When the
native builtin __nexus_codegen_emit_storage_c__ is present it is
preferred; otherwise this M implementation applies the same mapping.
See also codegen.