MATLAB: Is it possible to eliminate the BlockIO contents when generating code

autoEmbedded Coderglobalreusertbrtws-functionsimulink

When I try to generate code from my model using the Real-Time Workshop Embedded Coder I noticed that some of the block I/O signals are created as globals and defined in the BlockIO structure. This happens even if my signal storage is set to 'Auto' and I set the 'Menu –> Simulation –> Simulation Parameters… –> Advanced –> Signal Storage Reuse' option to 'ON'.
Is it possible to force the code generation to create the I/O signals as locals and not defined in the BlockIO structure?

Best Answer

The exact form of the generated code cannot be set in all situations using this method. Real-Time Workshop Embedded Coder puts signals into the block I/O whenever their values need to be persistent across time step, regardless of other settings. For example, the output of a triggered subsystem is an "implicit state" that needs to be persistent to honor the semantics of Simulink. The signal cannot be made local in cases like this; the only way to make them local is to change the semantics of the Simulink block diagram.
Refer to the Signal Object Configuration documentation at the following page:
(or)
>> web([docroot '/ecoder/gs/configuring-model-and-generating-code.html'])
In MATLAB 8.0 (R2012b), from MALTAB command line:
Signals described in the above documentation page, are in the category: [Auto] / [Signal storage resuse ON] / Cannot reuse signal. Note that the generated format appears identical to that generated when 'Signal storage reuse' is off.