coder.dictionary.create - Create Embedded Coder Dictionary and coder.Dictionary

  object - MATLAB ([original](https://www.mathworks.com/help/ecoder/ref/coder.dictionary.create.html)) ([raw](?raw))

Main Content

Create Embedded Coder Dictionary and coder.Dictionary object

Syntax

Description

[coderDict](#mw%5F312774cb-c52a-44d0-9a79-cf81acb1be4f) = coder.dictionary.create([sourceName](#mw%5F05ccfbf6-ff02-458b-8f54-1b98bd3f0c31)) creates an Embedded Coder® Dictionary in the model or Simulink® data dictionary identified by sourceName. The function returns a coder.Dictionary object that represents the new Embedded Coder Dictionary. The Embedded Coder Dictionary uses the data interface configuration type.

When the source model or data dictionary already has an Embedded Coder Dictionary, use coder.dictionary.open to access the coder.Dictionary object. An Embedded Coder Dictionary is created when you open a model in the Embedded Coder app or when you open the Embedded Coder Dictionary dialog box for a model or a data dictionary.

example

[coderDict](#mw%5F312774cb-c52a-44d0-9a79-cf81acb1be4f) = coder.dictionary.create([sourceName](#mw%5F05ccfbf6-ff02-458b-8f54-1b98bd3f0c31),[interfaceType](#mw%5F50ac6414-7b51-4f94-a71a-3a9d5acdc6dd)) creates an Embedded Coder Dictionary that uses the specified code interface type. You can create an Embedded Coder Dictionary that uses either the data interface configuration or service interface configuration by using this syntax. (since R2023b)

example

Examples

collapse all

Create a data dictionary.

dataDictionary = Simulink.data.dictionary.create("DataDictionary.sldd");

Create an Embedded Coder Dictionary in the data dictionary.

coderDictionary = coder.dictionary.create(dataDictionary);

coderDictionary =

Dictionary with Sections:

                StorageClasses: [1×1 coder.dictionary.Section]
                MemorySections: [1×1 coder.dictionary.Section]
FunctionCustomizationTemplates: [1×1 coder.dictionary.Section]

Create a data dictionary to store the Embedded Coder Dictionary.

dataDictionary = Simulink.data.dictionary.create("DataDictionary.sldd");

Create an Embedded Coder Dictionary in the data dictionary. Specify the service interface configuration type.

coderDictionary = coder.dictionary.create(dataDictionary,"ServiceInterface");

coderDictionary =

Dictionary with properties and Sections:

           ServicesHeaderFileName: 'services.h'
                InitTermFunctions: [1×1 coder.dictionary.Section]
       PeriodicAperiodicFunctions: [1×1 coder.dictionary.Section]
           DataReceiverInterfaces: [1×1 coder.dictionary.Section]
             DataSenderInterfaces: [1×1 coder.dictionary.Section]
           DataTransferInterfaces: [1×1 coder.dictionary.Section]
                  TimerInterfaces: [1×1 coder.dictionary.Section]
        ParameterTuningInterfaces: [1×1 coder.dictionary.Section]
ParameterArgumentTuningInterfaces: [1×1 coder.dictionary.Section]
            MeasurementInterfaces: [1×1 coder.dictionary.Section]
         SubcomponentInitTermFunctions: [1×1 coder.dictionary.Section]
SubcomponentPeriodicAperiodicFunctions: [1×1 coder.dictionary.Section]
           SharedUtilityFunctions: [1×1 coder.dictionary.Section]
                          InternalData: [1×1 coder.dictionary.Section]
                             Constants: [1×1 coder.dictionary.Section]
                   StorageClasses: [1×1 coder.dictionary.Section]
               DataMemorySections: [1×1 coder.dictionary.Section]
           FunctionMemorySections: [1×1 coder.dictionary.Section]

Now you can access the sections of the dictionary and use the sections to add and edit service interface definitions.

Input Arguments

collapse all

Name of target model file or data dictionary, specified as a character vector, string scalar, or Simulink.data.Dictionary object.

Example: "myLoadedModel"

Example: "myDictionary.sldd"

Data Types: char

Since R2023b

Code interface configuration type, specified as either"DataInterface" or "ServiceInterface". IfsourceName is a Simulink model, the interfaceType must be"DataInterface".

Choose the code interface configuration type by considering how you will deploy the generated code:

Example: "ServiceInterface"

Data Types: char

Output Arguments

Version History

Introduced in R2019b

expand all

You can now specify "Not measured" as the default value of theMeasurementInterfaces section in the coder dictionary, and you can specify "Not tunable" as the default value of theParameterTuningInterfaces andParameterArgumentTuningInterfaces sections in the dictionary. The"Not measured" and "Not tunable" entries are included in the dictionary, and are preselected as default values in newly created dictionaries. You can select other entries as dictionary default for these sections, but you cannot delete these entries from the dictionary.

Create an Embedded Coder Dictionary that uses the service interface configuration by specifying"ServiceInterface" for the second input argument. You can still create an Embedded Coder Dictionary that uses the data interface configuration by specifying"DataInterface" or by not specifying the second input argument.