MATLAB: Do I receive an error when building the model with the “Create Simulink (S-Function) block” option on

Embedded Coder

I have a simple model that uses an external parameter with a storage class of ImportFromFile. I added a header file par.h where the parameter is defined.
I want to generate an ERT S-Function wrapper that calls the generated code. However, the build of the model will only work when the "Create Simulink (S-Function) block" option is switched off.

Best Answer

You cannot use the "Create Simulink (S-Function) block" option if the external parameter is defined using the const qualifier. The reason this will not work is because the generated S-Function wrapper will try to overwrite that parameter.
The ImportFromFile storage class is not intended to be used with data declared with the const qualifier. When dealing with const data, you should create a new custom storage class.