MATLAB: Do I receive a warning about a parameter’s storage class being defined twice when I build the Simulink model in the Real-Time Workshop

compileexportedgenerategenerationglobalrtwsimulink coder

When I try to build by Simulink model in the Real-Time Workshop, I get a warning that says:
Warning: Parameter 'foo' (in the base workspace) is a Simulink parameter object but its storage class is also specified in the model's parameter configuration dialog. The setting in the dialog is being ignored.
The model includes model references, with some "ExportedGlobal" parameters.

Best Answer

This warning occurs because the storage class for a parameter say "foo" for example, is specified by both the Simulink.Parameter object (in the base workspace) and in an entry in the "Global (tunable) parameters" table for some model. This model may be your main model, or one of the referenced model.
This warning does not indicate that there is something wrong with the model compilation. It is simply there to alert you to the fact that certain settings--those for that variable in the "Global (tunable) parameters" table--are being ignored.
Removing the entry for "foo" from the "Global (tunable) parameters" table in your models should remove the warning.
To do this:
1. Open the relevant model's "Configuration" in the Model Explorer, or open the models "Configuration Parameters" window (Ctrl+E from the model).
2. Go to the "Optimization" section.
3. Press the "Configure" button, which is located to the right of the "Inline parameters" checkbox. This opens the "Model Parameter Configuration" window that includes the table.
4. Select the "foo" entry in the table, and press the "Remove" button.
You will have to find which is the offending model (or models). Your main model is likely it, but referenced models are also a possibility.
Simulink.Parameter variables are not normally available to add to the "Global (tunable) parameters" tables, but it is possible to have entry left over if "foo" was previously defined as a normal MATLAB variable.