Main Content

copyEntry

Class: coder.dictionary.Section
Namespace: coder.dictionary

Copy Embedded Coder Dictionary entry

Syntax

newEntry = copyEntry(sectionObj,defName)
newEntry = copyEntry(sectionObj,defName,targetCoderDict)

Description

newEntry = copyEntry(sectionObj,defName) copies the definition named defName in the Embedded Coder dictionary section represented by sectionObj. The copyEntry syntax returns a coder.dictionary.Entry object that represents the new definition.

newEntry = copyEntry(sectionObj,defName,targetCoderDict) creates a copy of the definition in the target Embedded Coder Dictionary represented by targetCoderDict.

Input Arguments

expand all

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

Name of Embedded Coder Dictionary definition that you want to copy, specified as a string.

Example: 'StorageClass2'

Target Embedded Coder Dictionary, specified as a coder.Dictionary object.

Output Arguments

expand all

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

Examples

expand all

Open the model RollAxisAutopilot and represent the Embedded Coder Dictionary by using a coder.Dictionary object. The dictionary contains an example storage class definition named SignalStruct.

openExample('RollAxisAutopilot')
coderDictionary = coder.dictionary.open('RollAxisAutopilot');

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

storageClassesSect = getSection(coderDictionary, 'StorageClasses');

Copy the storage class definition SignalStruct. The new storage class has the name SignalStruct_copy.

newEntry = copyEntry(storageClassesSect,'SignalStruct')
newEntry = 

  Entry with properties:

          Name: 'SignalStruct_copy'
    DataSource: 'RollAxisAutopilot'

Open the model RollAxisAutopilot and represent the Embedded Coder Dictionary with a coder.Dictionary object. The dictionary contains an example storage class definition named SignalStruct.

openExample('RollAxisAutopilot')
coderDictionary = coder.dictionary.open('RollAxisAutopilot');

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

storageClassesSect = getSection(coderDictionary, 'StorageClasses');

Create a data dictionary that contains an Embedded Coder Dictionary to store the copy of SignalStruct.

newSLDD = Simulink.data.dictionary.create('newSLDD.sldd');
slddCoderDictionary = coder.dictionary.create('newSLDD.sldd');

Copy the storage class definition SignalStruct from the model's Embedded Coder Dictionary to the data dictionary. The new storage class has the name SignalStruct.

newEntry = copyEntry(storageClassesSect,'SignalStruct',slddCoderDictionary)
newEntry = 

  Entry with properties:

          Name: 'SignalStruct'
    DataSource: 'X:\newSLDD.sldd'

Version History

Introduced in R2019b