Main Content

Simulink.data.Dictionary

Configure data dictionary

Description

A Simulink.data.Dictionary object represents a data dictionary. The object allows you to perform operations on the data dictionary such as save or discard changes, import data from the base workspace, and add other data dictionaries as references.

Creation

The functions Simulink.data.dictionary.create and Simulink.data.dictionary.open create a Simulink.data.Dictionary object.

Properties

expand all

This property is read-only.

Referenced data dictionaries by file name, returned as a cell array of character vectors. This property only lists directly referenced dictionaries whose parent is the Simulink.data.Dictionary object.

Whether linked models can use design data in the base workspace, specified as true or false.

To determine whether a dictionary provides access to the base workspace (including through referenced dictionaries), query the HasAccessToBaseWorkspace property.

For more information about this property, including restrictions that limit your ability to interact with base workspace data through the dictionary, see Continue to Use Shared Data in the Base Workspace.

Data Types: logical

This property is read-only.

Query whether models can use design data in the base workspace, returned as 1 (true) or 0 (false). If the dictionary or a referenced dictionary has the EnableAccessToBaseWorkspace property set to true, this property returns 1.

Use this property to determine whether models that link to the dictionary can use design data in the base workspace. You do not need to query each referenced dictionary to determine whether it has the EnableAccessToBaseWorkspace property set to true.

Data Types: logical

This property is read-only.

Indicator of unsaved changes to the data dictionary, returned as 0 or 1. The value is 1 if changes have been made since last data dictionary save and 0 if not.

This property is read-only.

Total number of entries in data dictionary, including those in referenced dictionaries, returned as an integer.

Object Functions

addDataSourceAdd reference data dictionary to parent data dictionary
closeClose connection between data dictionary and Simulink.data.Dictionary object
discardChangesDiscard changes to data dictionary
exportToVersionExport a Simulink.data.Dictionary object to a previous version
filepathFull path and file name of data dictionary
getSectionReturn Simulink.data.dictionary.Section object to represent data dictionary section
hideRemove data dictionary from Model Explorer
importEnumTypesImport enumerated type definitions to data dictionary
importFromBaseWorkspaceImport base workspace variables to data dictionary
listEntryList data dictionary entries
removeDataSourceRemove reference data dictionary from parent data dictionary
saveChangesSave changes to data dictionary
showShow data dictionary in Model Explorer

Examples

collapse all

Create a data dictionary file myNewDictionary.sldd and a Simulink.data.Dictionary object representing the new data dictionary. Assign the object to variable dd1.

dd1 = Simulink.data.dictionary.create('myNewDictionary.sldd')
dd1 = 

  data dictionary with properties:

          DataSources: {0x1 cell}
    HasUnsavedChanges: 0
           NumberOfEntries: 0

Create a Simulink.data.Dictionary object representing the existing data dictionary myDictionary_ex_API.sldd. Assign the object to variable dd2.

dd2 = Simulink.data.dictionary.open('myDictionary_ex_API.sldd')
dd2 = 

  Dictionary with properties:

          DataSources: {'myRefDictionary_ex_API.sldd'}
    HasUnsavedChanges: 0
           NumberOfEntries: 4

Version History

Introduced in R2015a