Main Content

Generate scalar inlined parameters as

Express scalar inlined parameter values in the generated code as literals or macros

Model Configuration Pane: Code Generation / Identifiers


Control expression of scalar inlined parameter values in the generated code. Block parameters appear inlined in the generated code when you set Configuration Parameters > Optimization > Default parameter behavior to Inlined.


This parameter:

  • Appears only for ERT-based targets.

  • Requires Embedded Coder® when generating code.


Literals (default) | Macros

Generates scalar inlined parameters as numeric constants.


Generates scalar inlined parameters as variables with #define macros. This setting makes generated code more readable.


expand all

When you generate efficient code by inlining the numeric values of block parameters (with the configuration parameter Default parameter behavior), you can configure scalar parameters to appear as macros instead of literal numbers. Each macro has a unique name that is based on the name of the corresponding block parameter.

Open the example model sldemo_fuelsys_dd_controller.


The model uses these configuration parameter settings:

  • Default parameter behavior set to Inlined.

  • System target file set to ert.tlc.

Set the configuration parameter Generate scalar inlined parameters as to Macros.


Generate code from the model.

### Starting build procedure for: sldemo_fuelsys_dd_controller
### Successful completion of code generation for: sldemo_fuelsys_dd_controller

Build Summary

Top model targets built:

Model                         Action           Rebuild Reason                                    
sldemo_fuelsys_dd_controller  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 33.822s

The header file sldemo_fuelsys_dd_controller_private.h defines several macros that represent inlined (nontunable) block parameters. For example, the macros rtCP_DiscreteFilter_NumCoe_EL_0 and rtCP_DiscreteFilter_NumCoe_EL_1 represent floating-point constants.

file = fullfile('sldemo_fuelsys_dd_controller_ert_rtw',...
coder.example.extractLines(file,'#define rtCP_DiscreteFilter_NumCoe_EL_0',...
#define rtCP_DiscreteFilter_NumCoe_EL_0 (8.7696F)
#define rtCP_DiscreteFilter_NumCoe_EL_1 (-8.5104F)

The comments above the macro definitions indicate that the code generated for a Discrete Filter block uses the macros.

coder.example.extractLines(file,'Computed Parameter: DiscreteFilter_NumCoef',...
    'Referenced by: ''<S12>/Discrete Filter''',1,1)
/* Computed Parameter: DiscreteFilter_NumCoef
 * Referenced by: '<S12>/Discrete Filter'

Click the hyperlink to navigate to the block in the model.

Recommended Settings

DebuggingNo impact
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

Parameter: InlinedPrmAccess
Type: character vector
Value: Literals | Macros
Default: Literals

Version History

Introduced before R2006a