Main Content

getModelVariantControl

Get code configuration from code mappings for Simulink.VariantControl object

Since R2025a

    Description

    propertyValue = getModelVariantControl(codeMappingObj,variantControl,property) returns the value of a code mapping property or calibration property for the specified Simulink.VariantControl object. Use this function to return the storage class or the calibration access of a calibration property configured for the variant control. Specifying code generation attributes for a Simulink.VariantControl object using code mappings is supported when the object is defined in the model workspace and its Value property is set to a Simulink.Parameter object.

    example

    Examples

    collapse all

    From the model code mappings for the model slexVariantParameterCodeMappings, get the name of the storage class of variant control Wiper.

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

    Input Arguments

    collapse all

    Code mapping object (model code mappings) returned by a call to function coder.mapping.api.get.

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

    Example: "varCtrl"

    Data Types: char | string

    Code mapping property name. The getModelVariantControl 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 ReturnProperty Name
    Name of storage classStorageClass
    Name of variable for the variant control in the generated codeIdentifier
    Boolean value indicating whether to export the selected variant control to an A2L calibration fileExport
    Mask value in hexadecimal format to extract single bits from the variant control in a calibration toolBitMask
    Enumeration value indicating the access of calibration:
    • Calibration for a variant control indicates that the variant control can be calibrated and is the default value for the property.

    • NoCalibration indicates that the variant control can be read-only and cannot be calibrated.

    CalibrationAccess
    Name of the conversion method used during the calibrationCompuMethod
    Optional display name of the variant control for calibrationDisplayIdentifier
    Display format of the variant control being calibrated in a calibration toolFormat

    Example: "StorageClass"

    Output Arguments

    collapse all

    Name of the storage class or value of the specified storage class property configured for the variant control, returned as a character vector.

    Version History

    Introduced in R2025a