addEntry

Class: coder.dictionary.Section
Package: coder.dictionary

Add a new entry to Embedded Coder Dictionary section

Syntax

addEntry(sectionObj,defName)
entryObj = addEntry(sectionObj,entryName)

Description

addEntry(sectionObj,defName) adds a definition named defName to the Embedded Coder Dictionary section sectionObj, a coder.dictionary.Section object.

entryObj = addEntry(sectionObj,entryName) returns a coder.dictionary.Entry object that represents the new Embedded Coder Dictionary definition.

Input Arguments

expand all

Section in the Embedded Coder Dictionary, specified as a coder.dictionary.Section object. The section name identifies the type of code definition that addEntry creates.

Name of newly created Embedded Coder Dictionary definition, specified as a character vector or string scalar.

Example: 'StorageClass2'

Output Arguments

expand all

New Embedded Coder Dictionary entry, returned as a coder.dictionary.Entry object. The new entry represents the new code definition in the section of the Embedded Coder Dictionary.

Examples

expand all

Open the model rtwdemo_roll and represent the Embedded Coder Dictionary by using a coder.Dictionary object. Use this object to access the Storage Classes section of the dictionary, which contains the storage class definitions.

rtwdemo_roll
coderDictionary = coder.dictionary.open('rtwdemo_roll');

Create a coder.dictionary.Section object that represents the Storage Classes section of the Embedded Coder Dictionary.

storageClassesSect = getSection(coderDictionary, 'StorageClasses');

Add a storage class definition named MyStorageClass to the Storage Classes section. The storage class definition uses the default property settings. You can change these settings by using the set function.

newEntry = addEntry(storageClassesSect,'MyStorageClass')
newEntry = 

  Entry with properties:

          Name: 'MyStorageClass'
    DataSource: 'rtwdemo_roll'
Introduced in R2019b