Main Content

coder.mapping.defaults.get

Return value of property for model default mapping category

Description

example

value = coder.mapping.defaults.get(model,category,property) returns the value of a property for a data or function default mapping category for a model. To determine valid category and property combinations, use calls to functions coder.mapping.defaults.dataCategories, coder.mapping.defaults.functionCategories, and coder.mapping.defaults.allowedProperties.

Examples

collapse all

For model rtwdemo_configuredefaults, return the storage class that the code generator uses for data imported into the model from external header and definitions files.

Determine the category name to specify for model input data by calling coder.mapping.defaults.dataCategories.

coder.mapping.defaults.dataCategories()

ans =

  1×9 cell array

  Columns 1 through 4

    {'Inports'}    {'Outports'}    {'ModelParameters'}    {'ModelParameterA...'}

  Columns 5 through 8

    {'ExternalParamet...'}    {'SharedLocalData...'}    {'GlobalDataStores'}    {'InternalData'}

  Column 9

    {'Constants'}

Specify Inports as the category name.

Identify properties that you can configure for category Outports by calling coder.mapping.defaults.allowedProperties.

coder.mapping.defaults.allowedProperties('rtwdemo_configdefaults', 'Outports')

ans =

  4×1 cell array

    {'StorageClass'  }
    {'HeaderFile'    }
    {'DefinitionFile'}
    {'Owner'         }

Use a call to function coder.mapping.defaults.get to return the setting for category Inports and property StorageClass.

coder.mapping.defaults.get('rtwdemo_configdefaults', 'Inports', 'StorageClass')

ans =

    'ImportFromFile'

For model rtwdemo_configuredefaults, return the memory section that the code generator uses for model execution entry-point functions, such as step.

Determine the category name to specify for execution functions by calling coder.mapping.defaults.functionCategories.

coder.mapping.defaults.functionCategories()

ans =

  1×3 cell array

    {'InitializeTerminate'}    {'Execution'}    {'SharedUtility'}

Specify Execution as the category name.

Identify properties that you can configure for category Execution by calling coder.mapping.defaults.allowedProperties.

coder.mapping.defaults.allowedProperties('rtwdemo_configdefaults', 'Execution')

ans =

  1×1 cell array

    {'FunctionCustomizationTemplate'}

Use a call to function coder.mapping.defaults.get to return the setting for category Execution and property FunctionCustomizationTemplate.

coder.mapping.defaults.get('rtwdemo_configdefaults', 'Execution', 'FunctionCustomizationTemplate')

ans =

    'exFastFunction'

Input Arguments

collapse all

Model file, specified as a character vector. The model must be loaded (for example, by using load_system) or open. You can omit the .slx file extension.

Example: 'myLoadedModel'

Data Types: char

Category name, specified as a character vector. To get valid data and function category names, call the functions coder.mappings.defaults.dataCategories and coder.mappings.defaults.functionCategories.

Example: 'ModelParameters'

Data Types: char

Property name, specified as a character vector. To get valid property names for a default mapping category, call the function coder.mappings.defaults.allowedProperties.

Example: 'StorageClass'

Data Types: char

Output Argument

collapse all

Character vector that is the setting of the specified default mapping category and property for the specified model.

Introduced in R2018a