Main Content

coder.mapping.utils.create

Create code mappings object for configuring data and function interface for C and C++ code generation

    Description

    example

    myCodeMappingObj = coder.mapping.utils.create(model) creates code mappings environment for the specified model and returns the mappings as object myCodeMappingObj. Code mappings associate model data elements and functions with configurations for C or C++ code generation. If code mappings exist for the specified model, the function returns those code mappings.

    myCodeMappingObj = coder.mapping.utils.create(dictionary) creates C code mappings environment for the specified data dictionary and returns the mappings as object myCodeMappingObj. Code mappings associate data elements and functions with configurations for C or C++ code generation. If code mappings exist for the specified data dictionary, the function returns those code mappings.

    example

    myCodeMappingObj = coder.mapping.utils.create(model,configObj) imports default memory section and shared utility naming rule configurations from configuration set configObj while creating C code mappings for the specified model. See Migration of Memory Section and Shared Utility Settings from Configuration Parameters to Code Mappings.

    Examples

    collapse all

    For model myConfigModel, create C code mappings by calling coder.mapping.utils.create. Then, get the code mappings with a call to coder.mapping.api.get.

    myCodeMappingObj = coder.mapping.utils.create('myConfigModel');
    myCodeMappingObj = coder.mapping.api.get('myConfigModel');

    For model myConfigModel, import memory section and shared utility naming rule configurations from configuration set myConfigSet while creating C code mappings.

    myCodeMappingObj = coder.mapping.utils.create('myConfigModel','myLegacyConfigSet');

    After calling this function, call coder.mapping.api.get to get the code mapping object.

    Input Arguments

    collapse all

    Model file for which to create and return a code mappings object, specified as a handle or a character vector or string scalar representing the model name. The model must be loaded (for example, by using load_system) or open. Omit the .slx file extension.

    Example: 'myConfigModel'

    Data Types: char | string | model_handle

    Data dictionary for which to return code mappings object, specified as a character vector or string scalar representing the dictionary name.

    Example: 'exCodeDefs.sldd'

    Data Types: char | string

    Model configuration object from which to import memory section and shared utility naming rule configurations while creating code mappings for model, specified as a handle, character vector or string scalar. Specify a configuration set object to preserve memory section definitions or shared utility naming rules applied to a model in a version of Embedded Coder® prior to R2018a.

    Example: 'my_legacyConfigset'

    Output Arguments

    collapse all

    The model or dictionary code mappings, returned as a CodeMapping object, a CodeMappingCPP object, or a CoderDictionary object.

    OutputInput Object
    coder.mapping.api.CodeMappingSimulink® model configured for C code generation
    coder.mapping.api.CodeMappingCPPSimulink model configured for C++ code generation
    coder.mapping.api.CoderDictionarySimulink data dictionary

    Introduced in R2020b