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.

    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');

    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

    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.CodeMappingCPP (Embedded Coder)Simulink model configured for C++ code generation
    coder.mapping.api.CoderDictionarySimulink data dictionary

    Introduced in R2020b