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.
[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)
Examples
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
Name of target model file or data dictionary, specified as a character vector, string scalar, or Simulink.data.Dictionary
object.
- A model must be loaded (for example, by using
load_system
) or open.
You do not need to specify the.slx
file extension. - A dictionary must be open in the Model Explorer, in the current folder, or on the MATLAB® path.
You must specify the.sldd
file extension.
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:
- Data interface configuration — The code generator creates a program intended to run on the target device. The generated code uses the data interfaces that you define.
- Service interface configuration — The code generator creates an algorithm that you intend to deploy within a larger application. The platform middleware calls the algorithm code and provides the services for the target device. The generated code calls the services according to your definitions in the service interface configuration. To create a service interface configuration, you must use an Embedded Coder Dictionary that is stored in a Simulink data dictionary.
Example: "ServiceInterface"
Data Types: char
Output Arguments
Version History
Introduced in R2019b
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.
Constants
andInternalData
are new dictionary sections.- The dictionary sections
SubcomponentInitTermFunctions
andSubcomponentPeriodicAperiodicFunctions
replace the sectionSubcomponentEntryFunctions
.
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.