Main Content

Simulink.data.dictionary.getOpenDictionaryPaths

Return file names and paths of open data dictionaries

Description

example

openDDs = Simulink.data.dictionary.getOpenDictionaryPaths returns the file names and paths of all data dictionaries that are open. For example, a data dictionary is open if you create objects, such as Simulink.data.Dictionary, that refer to the dictionary. If you open two or more dictionaries that have the same file name but different file paths, this function returns multiple file paths.

Before executing commands and functions that cannot operate when dictionaries are open, use this function to identify open dictionaries so that you can close them. For example, when you run parallel simulations as described in Sweep Variant Control Using Parallel Simulation, this function helps you identify open dictionaries before executing the command Simulink.data.dictionary.cleanupWorkerCache.

openDDs = Simulink.data.dictionary.getOpenDictionaryPaths(dictFileName) returns the file paths of data dictionaries that have the file name dictFileName. If you open two or more dictionaries that have the same file name but different file paths, you can use this syntax to return all of the file paths.

Examples

collapse all

Open, identify, and close a data dictionary. After you close the connections to the dictionary, you can use commands and functions, such as Simulink.data.dictionary.cleanupWorkerCache, that cannot operate when dictionaries are open.

At the command prompt, open a data dictionary by creating a Simulink.data.Dictionary object that refers to the dictionary.

For example, open the Using a Data Dictionary to Manage the Data for a Fuel Control System example data dictionary.

openExample('simulink_automotive/UseDDForFuelContSysExample'
dictObj = Simulink.data.dictionary.open('sldemo_fuelsys_dd.sldd');

Display the dictionary in the Model Explorer

show(dictObj)

Identify all of the dictionaries that are open.

openDDs = Simulink.data.dictionary.getOpenDictionaryPaths;

The file path of the dictionary that you opened, sldemo_fuelsys_dd.sldd, appears in the cell array of character vectors openDDs.

Close the connection from the Model Explorer to the dictionary.

hide(dictObj)

The dictionary no longer appears as a node in the Model Hierarchy pane of the Model Explorer.

Close the connection from the Simulink.data.Dictionary object to the dictionary.

close(dictObj)
clear dictObj

Input Arguments

collapse all

File name of target data dictionary or dictionaries, specified as a character vector. Use the file extension sldd.

Example: 'myDict.sldd'

Data Types: char

Output Arguments

collapse all

File names and paths of open data dictionaries, returned as a cell array of character vectors.

Tips

A data dictionary is open if any of these conditions are true:

  • The dictionary appears as a node in the Model Hierarchy pane of the Model Explorer. To close this connection to the dictionary, right-click the node in Model Explorer and select Close. Alternatively, use the hide method of a Simulink.data.Dictionary object.

  • You created an object of any of these classes that refer to the dictionary:

    • Simulink.data.Dictionary

    • Simulink.data.dictionary.Section

    • Simulink.data.dictionary.Entry

    To close these connections to the dictionary, use the close method of the Simulink.data.Dictionary object or clear the object. Clear the Simulink.data.dictionary.Section and Simulink.data.dictionary.Entry objects.

  • A model that is linked to the dictionary is open. To close this connection to the dictionary, close the model.

Version History

Introduced in R2016a