coder.dictionary.remove - Remove Embedded Coder Dictionary from model or Simulink data dictionary - MATLAB (original) (raw)

Main Content

Remove Embedded Coder Dictionary from model or Simulink data dictionary

Syntax

Description

remove([sourceName](#d126e9156)) removes Embedded Coder Dictionary definitions from your model or SimulinkĀ® data dictionary identified by sourceName. When you remove the Embedded Coder Dictionary from a model, you remove custom definitions and definitions from packages that you have loaded. The model still contains the local dictionary with definitions from the SimulinkBuiltIn package. When you remove the Embedded Coder Dictionary from a model that does not have an attached Simulink data dictionary with definitions, the remaining local dictionary contains definitions from the Simulink package. When you remove the Embedded Coder Dictionary from a Simulink data dictionary, you remove the entire Embedded Coder Dictionary, including its packages and definitions.

Use this function to:

To migrate code generation definitions from one source to another (for example, from a model file to a Simulink data dictionary), consider using coder.dictionary.move.

example

Examples

collapse all

When you open the Embedded Coder Dictionary window for a model (see Open the Embedded Coder Dictionary) or open the Code perspective for a model, Simulink creates an Embedded Coder Dictionary in the model file. In this example, create a code generation definition (a storage class) in the Embedded Coder Dictionary of the example model RollAxisAutopilot, then remove the Embedded Coder Dictionary from the model.

Open the model RollAxisAutopilot and represent the Embedded Coder Dictionary by using a coder.Dictionary object. Use this object to access the Storage Classes section of the dictionary and represent the section by using acoder.dictionary.Section object.

openExample('RollAxisAutopilot') coderDictionary = coder.dictionary.open('RollAxisAutopilot'); 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.

newEntry = addEntry(storageClassesSect,'MyStorageClass')

newEntry =

Entry with properties:

      Name: 'MyStorageClass'
DataSource: 'RollAxisAutopilot'

At the command prompt, remove the Embedded Coder Dictionary from the model.

coder.dictionary.remove('RollAxisAutopilot')

Now, the model file contains an Embedded Coder Dictionary with only the code generation definitions from the Simulink and SimulinkBuiltIn packages.

Input Arguments

collapse all

Target model file or data dictionary, specified as a character vector or string scalar.

Example: 'myLoadedModel'

Example: 'myDictionary.sldd'

Data Types: char

Tips

To use coder.dictionary.remove on a data dictionary that references other data dictionaries, you must:

  1. Temporarily remove references to dictionaries that also contain code generation definitions.
  2. Use coder.dictionary.remove on the target dictionary.
  3. Restore the dictionary references that you removed.

Version History

Introduced in R2018a

expand all

When you use the function coder.dictionary.remove on a model, the function removes only the local definitions from packages that you have loaded and local custom definitions. The model still contains the local dictionary with definitions from the SimulinkBuiltIn package.