getModelParameter

Get code configuration from code mappings for model parameters

    Description

    example

    propertyValue = getModelParameter(myCodeMappingObj,modelParameter,property) returns the value of a code mapping property for the specified model workspace parameter or model parameter argument. Use this function to return the storage class or the value of a storage class property configured for the parameter or parameter argument.

    Examples

    collapse all

    From the model code mappings for model myConfigModel, get the name of the storage class that is configured for model parameter K1.

    cm = coder.mapping.api.get('myConfigModel');
    scK1 = getModelParameter(cm,'K1','StorageClass');
    

    From the model code mappings for model myConfigModel, get the code identifier configured for model parameter Table1.

    cm = coder.mapping.api.get('myConfigModel');
    idTable1 = getModelParameter(cm,'Table1','Identifier');
    

    From the model code mappings for model myConfigModel, get the storage class and code identifier configured for model parameter arguments LOWER and UPPER.

    cm = coder.mapping.api.get('myConfigModel');
    scLOWER = getModelParameter(cm,'LOWER','StorageClass');
    scUPPER = getModelParameter(cm,'UPPER','StorageClass');
    idLOWER = getModelParameter(cm','LOWER','Identifier');
    idUPPER = getModelParameter(cm','UPPER','Identifier');
    

    Input Arguments

    collapse all

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

    Example: myCM

    Name of the model workspace parameter or model parameter argument for which to return the code mapping information.

    Example: 'Table1'

    Data Types: char | string

    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 the parameter or parameter argument in the generated codeIdentifier
    Name of source definition file that contains definitions for global data that is read by the parameter or parameter argument and external codeDefinitionFile
    Name of get function called by code generated for the parameter or parameter argument GetFunction
    Name of source header file that contains declarations for global data that is read by the parameter or parameter argument and external codeHeaderFile
    Name of model for which the code generator places the definition for the parameter or parameter argument shared by multiple models in a model hierarchy Owner
    Boolean value indicating whether code generator preserves dimensions of a parameter or parameter argument that is represented as a multidimensional arrayPerserveDimensions
    Name of set function called by code generated for the parameter or parameter argument SetFunction
    Name of structure in generated code for the parameter or parameter argument StructName

    Example: 'StorageClass'

    Output Arguments

    collapse all

    Name of the storage class or value of the specified storage class property configured for model parameter or parameter argument .

    Data Types: char

    Introduced in R2020b