getModelVariantVariable - Get code configuration from code mappings for

    Simulink.VariantVariable object - MATLAB ([original](https://www.mathworks.com/help/ecoder/ref/getmodelvariantvariable.html)) ([raw](?raw))

Main Content

Get code configuration from code mappings forSimulink.VariantVariable object

Since R2025a

Syntax

Description

[propertyValue](#mw%5Fe39051c6-f3b3-4aaf-a1c7-b971ef2139c8) = getModelVariantVariable([codeMappingObj](#mw%5F56e70abc-141a-49f2-a319-46ccea9fcd32),[variantVariable](#mw%5Fb6e82e9a-516a-47f0-8460-232b9ea9a15e),[property](#mw%5Faced8c97-02fb-49d7-8fd7-411864c8ede2)) returns the value of a code mapping property for the specified Simulink.VariantVariable object variantVariable (also referred to as a variant parameter) from the code mappingcodeMappingObj. A Simulink.VariantVariable object derives its code mappings from the Simulink.Parameter object that is used to set the Specification property of the object. The getModelVariantVariable function returns the storage class and storage class property settings configured for theSimulink.VariantVariable object from thisSimulink.Parameter object. For code mappings support, theSimulink.VariantVariable object and its associatedSimulink.VariantControl and Simulink.Parameter objects must be defined in the model workspace of the model.

example

Examples

collapse all

From the model code mappings for the modelslexVariantParameterCodeMappings, get the name of the storage class of the variant variable GearRatio.

openExample("simulinkcoder/ConfigureCodeGenForVariantParametersInModelWorkspaceExample"); cm = coder.mapping.api.get("slexVariantParameterCodeMappings"); getModelVariantVariable(cm,"GearRatio","StorageClass");

Input Arguments

collapse all

Name of Simulink.VariantVariable object, specified as a character vector or string scalar.

Example: "GearRatio"

Data Types: char | string

Code mapping property name. The getModelVariantVariable function returns the value of this property. For a storage class defined in the Embedded Coder Dictionary associated with the model, specify a property name or one of these property names.

Information to Return Property Name
Name of storage class StorageClass
Name of variable for the variant parameter in the generated code Identifier
Name of source definition file that contains definitions for global data that is read by the variant parameter and external code DefinitionFile
Name of get function called by code generated for the variant parameter GetFunction
Name of source header file that contains declarations for global data that is read by the variant parameter and external code HeaderFile
Name of model for which the code generator places the definition for the variant parameter shared by multiple models in a model hierarchy Owner
Boolean value indicating whether the code generator preserves dimensions of a variant parameter that is represented as a multidimensional array PerserveDimensions
Name of set function called by code generated for the variant parameter SetFunction
Name of structure in generated code for the variant parameter StructName
Name of parameter argument tuning service defined in Embedded Coder Dictionary ParameterArgumentTuningService
Name of parameter tuning service defined in Embedded Coder Dictionary ParameterTuningService

Example: "StorageClass"

Output Arguments

collapse all

Name of the storage class or value of the specified storage class property configured for the Simulink.VariantVariable object, returned as a character vector.

Version History

Introduced in R2025a