Simulink.VariantBankCoderInfo Class
Namespace: Simulink
Description
A variant parameter, which is a Simulink.VariantVariable
object, helps you to vary the values of block parameters
in a Simulink® model conditionally. To improve the efficiency and readability of the code
generated for a model that uses variant parameters by Embedded Coder®, you can use a variant parameter bank. A variant parameter bank is a Simulink.VariantBank
object that groups variant parameters with the same variant
conditions into a structure in generated code and uses a pointer mechanism to access the
active set of values from the structure array. To specify code generation properties for the
variant parameter bank structure array and pointer variable, create objects of the
Simulink.VariantBankCoderInfo
class.
You can control code placement by setting the HeaderFile
and
DefinitionFile
properties of the
Simulink.VariantBankCoderInfo
object. Specify the memory section to place the
values in the compiled code by providing code statements in the
PreStatement
and PostStatement
properties. Variant
parameter banks allow you to specify these attributes separately for the variant parameter
bank structure array and pointer variable using the
AllChoicesCoderInfo
and ActiveChoiceCoderInfo
properties (since R2025a). To apply the same code generation properties for both the structure
array and the pointer variable, set the AllChoicesCoderInfo
and
ActiveChoiceCoderInfo
properties to the same
Simulink.VariantBankCoderInfo
object.
Note
You can add Simulink.VariantBank
and
Simulink.VariantBankCoderInfo
objects to the base workspace or the
Design Data section of a data dictionary either programmatically or
from the Add menu in the Model Explorer.
When using both Specification
and Bank
properties for a Simulink.VariantVariable
object, the specification object
must have storage class set to Auto
and it must not use symbolic
dimensions. For a variant parameter bank, use a Simulink.VariantBankCoderInfo
object to specify code generation
attributes.
Creation
Description
returns a varParamBankCoderInfo
= Simulink.VariantBankCoderInfoSimulink.VariantBankCoderInfo
object with default property
values.
returns a varParamBankCoderInfo
= Simulink.VariantBankCoderInfo(PropertyName=Value
)Simulink.VariantBankCoderInfo
object and sets properties using
one or more name-value arguments.
Properties
Examples
Tips
To modify a Simulink.VariantBankCoderInfo
object, double-click the object
to open the Simulink.VariantBankCoderInfo
dialog box.