MATLAB: Does having a comment with “%%” in a chart in Stateflow result in incorrect code generation using Real-Time Workshop

*/%%codecodegencommmentcorruptrtwstateflowtlc

I have a Stateflow chart with the characters "%%" as a comment on a transition. When I generate code for this chart using Real-Time Workshop code generator, I do not receive any errors. But the generated code gives me incorrect results.

Best Answer

This bug has been fixed for Release 14 (R14). For previous releases, please read below for any possible workarounds:
This has been verified as a bug in Stateflow in the way that Stateflow handles generation of TLC files for Real-Time Workshop.
Currently, to work around this issue, try to avoid the following type of usage of the "%%" characters:
/* user comment containing %%*/
{
strcpy(str,"a = %%");
}