coder.dictionary.Section.copyEntry - Copy Embedded Coder Dictionary entry - MATLAB (original) (raw)

Main Content

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

Copy Embedded Coder Dictionary entry

Syntax

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

Description

[newEntry](#mw%5F5a12743f-67b6-4863-bef6-e6ca0efa14b3) = copyEntry([sectionObj](#mw%5Fc12a1be9-793e-40ce-95c7-05c85f4d960d),[defName](#mw%5Fa648ac70-f538-465e-8da9-bd2caf2639db)) 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](#mw%5F5a12743f-67b6-4863-bef6-e6ca0efa14b3) = copyEntry([sectionObj](#mw%5Fc12a1be9-793e-40ce-95c7-05c85f4d960d),[defName](#mw%5Fa648ac70-f538-465e-8da9-bd2caf2639db),[targetCoderDict](#mw%5Fbdbe41da-f511-4d91-9f28-c44c990f558f)) creates a copy of the definition in the target Embedded Coder Dictionary represented bytargetCoderDict.

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'

Output Arguments

expand all

New Embedded Coder Dictionary entry, returned as acoder.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 namedSignalStruct.

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 nameSignalStruct.

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

newEntry =

Entry with properties:

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

Version History

Introduced in R2019b