Main Content


Remove Embedded Coder Dictionary from model or Simulink data dictionary



remove(sourceName) 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:

  • Remove Embedded Coder Dictionary definitions from a model.

  • In a hierarchy of referenced Simulink data dictionaries, remove the Embedded Coder Dictionary from a data dictionary. In a hierarchy of referenced dictionaries, only one dictionary can store an Embedded Coder Dictionary.

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.


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 a coder.dictionary.Section object.

coderDictionary ='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.


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.

  • 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


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