getState

Get code configuration from code mappings for block state

    Description

    example

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

    Examples

    collapse all

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

    cm = coder.mapping.api.get('myConfigModel');
    scX = getState(cm,'myConfigModel/Delay','StorageClass');
    

    From the model code mappings for model myConfigModel, get the code identifier that is configured for state X of Unit Delay block Delay.

    cm = coder.mapping.api.get('myConfigModel');
    scX = getState(cm,blockHandle,'Identifier');
    

    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. Specify one of these property names or a property name for a storage class defined in the Embedded Coder Dictionary associated with the model.

    Information to ReturnProperty Name
    Name of storage classStorageClass
    Name of variable for state in the generated codeIdentifier
    Name of source definition file that contains definitions for global data that is read by the state and external codeDefinitionFile
    Name of get function called by code generated for the stateGetFunction
    Name of source header file that contains declarations for global data that is read by the state and external codeHeaderFile
    Name of memory section that contains data read by the stateMemorySection
    Name of model for which the code generator places the definition for state shared by multiple models in a model hierarchy Owner
    Boolean value indicating whether code generator preserves dimensions of an state that is represented as a multidimensional arrayPerserveDimensions
    Name of set function called by code generated for stateSetFunction
    Name of structure in generated code for stateStructName

    Example: 'StorageClass'

    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

    Introduced in R2020b