MATLAB: How to specify the storage class of parameters in the model workspace in Real-Time Workshop 6.0 (R14)

classexportedglobalimportedexternmodelrtwsimulink coderstorageworkspace

I am trying to utilize the new model workspace feature in Simulink 6.0 (R14) to store initialization variables at the model level. This would be very convenient for me to ensure all variables are self-contained in the model.
However, when I attempt to configure the storage class code generation options for these variables, Real-Time Workshop only looks in the base workspace, and the parameters associated with the model workspace variables cannot have their storage class configured. Note that this limitation eliminates the convenience gained in including the variables as self-contained variables in the model workspace.
Is there any way around this? Can I declare the Real-Time Workshop storage class of variables contained in the model workspace?

Best Answer

The ability to configure the Real-Time Workshop storage class for variables in the model workspace is not available in Real-Time Workshop 6.0 (R14). All parameters must be defined in the base workspace.
No workarounds exist. The only workspace that determines the parameter storage class is the base workspace. The primary purpose of the model workspace is to support model referencing, which allows separate models to contain their own workspace variables.
You can, however, use a model callback routines to automatically load MATLAB commands, an M-script, or a MAT file during file initialization, which can automate the process of initializing variables in the base workspace. This is discussed in Simulink documentation and in the following Tech-Note:
MathWorks - Support - Support - How Can I Use Model Callback Routines to Change the Parameters of My Simulink Model?