You may store each input and output signal in a separate structure by setting the input and output signals' "Storage Class" to "ExportedGlobal".
To do this in Simulink R2015b, do the following:
1. Right click on the signal.
2. In the "Signal Properties" dialog box, ensure that the "Signal name" is filled in.
3. On the "Code Generation" tab, select "Package: Simulink" and "Storage Class: ExportedGlobal".
To do this in Simulink R2017b, do the following:
1. In the model menu bar, click on "View" -> "Model Data."
2. In the "Model Data" window top left corner drop down menu, select "Code".
3. In the "Inports/Outports" tab, set the "Storage Class" to "ExportedGlobal"
You may customize the code in this way if you are using Embedded Coder (".ert" taget), but you may not do this when you are using the more basic Simulink Coder (".grt" target).
You may find more information on the ExportedGlobal storage class at the links below:
Best Answer