Main Content

getState

Get code and calibration configuration from code mappings for block state

Since R2020b

    Description

    propertyValue = getState(myCodeMappingObj,block,property) returns the value of a code mapping property or calibration property for the state of the specified block. For example, use this function to return the storage class or calibration access of a measurement property configured for a block state.

    example

    Examples

    collapse all

    From the model code mappings for model ConfigurationRapidPrototypingInterface, get the name of the storage class that is configured for state X of Unit Delay block Delay.

    openExample("ConfigurationRapidPrototypingInterface");
    cm = coder.mapping.api.get("ConfigurationRapidPrototypingInterface");
    state = find(cm,"State");
    scX = getState(cm,state,"StorageClass");
    

    From the model code mappings for model ConfigurationRapidPrototypingInterface, get the calibration properties configured for state X of Unit Delay block Delay.

    openExample("ConfigurationRapidPrototypingInterface");
    cm = coder.mapping.api.get("ConfigurationRapidPrototypingInterface");
    state = find(cm,"State");
    prop_export = getState(cm,state,"Export");
    prop_bitmask = getState(cm,state,"BitMask");
    prop_calaccess = getState(cm,state,"CalibrationAccess");
    prop_compname = getState(cm,state,"CompuMethod");
    prop_dispid = getState(cm,state,"DisplayIdentifier");
    prop_format = getState(cm,state,"Format");
    

    Input Arguments

    collapse all

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

    Example: myCM

    Path of the block for which to return the state code mapping information, specified as a character vector or string scalar. Alternatively, you can specify a block handle.

    Example: blockHandle

    Data Types: char | string | block_handle

    Code mapping property for which to return a value. 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 state in the generated codeIdentifier
    Boolean value indicating whether to export the selected state to a calibration file (a2l)Export
    Mask value in hexadecimal format to extract single bits from the state in a calibration toolBitMask
    Enumeration value indicating the access of calibration. Calibration for a state indicates that the state can be calibrated. NoCalibration indicates that the state can be read-only but cannot be calibrated. NoCalibration is the default value for the propertyCalibrationAccess
    Name of the conversion method used during the calibrationCompuMethod
    Optional display name of the state for calibrationDisplayIdentifier
    Specifies the display format of the state being measured in a calibration toolFormat
    Name of the measurement serviceMeasurementService

    Example: "StorageClass"

    Example: "CalibrationAccess"

    Output Arguments

    collapse all

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

    Data Types: char

    Version History

    Introduced in R2020b