MATLAB: Do I not see any definitions for the Simulink.Parameter object in the generated code when using ‘CompilerFlag’ storage class

compileflagcustomstorageclassdefinitionEmbedded Coderheadermacro

I have a parameter defined in the Simulink Model Explorer. I've set the storage class of the parameter to 'CompilerFlag' in the hope that I'll see a definition for the parameter in one of the header files in the generated code. However, all I see is the following:
#ifndef myParam
#error The variable for the parameter "myParam" is not defined
Where is the parameter defined?

Best Answer

  • When using the 'CompilerFlag' storage class, Embedded Coder expects the user to provide the definition for the parameter through a compiler flag. For information on how to do this, please refer to the following documentation:
    If you wish to see the parameter defined in the generated code, please consider using the 'Define' storage class. This will create a separate header file and place the parameter definition within that file. For more information on this storage class, please refer to the following link: