Main Content

Simulink.data.dictionary.getOpenDictionaryPaths

Return file names and paths of open data dictionaries

Description

example

openDDs= Simulink.data.dictionary.getOpenDictionaryPathsreturns the file names and paths of all data dictionaries that are open. For example, a data dictionary is open if you create objects, such asSimulink.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 inSweep Variant Control Using Parallel Simulation, this function helps you identify open dictionaries before executing the commandSimulink.data.dictionary.cleanupWorkerCache

openDDs= Simulink.data.dictionary.getOpenDictionaryPaths(dictFileName)returns the file paths of data dictionaries that have the file namedictFileName。如果你打开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 asSimulink.data.dictionary.cleanupWorkerCache, that cannot operate when dictionaries are open.

At the command prompt, open a data dictionary by creating aSimulink.data.Dictionaryobject that refers to the dictionary.

For example, open theUsing a Data Dictionary to Manage the Data for a Fuel Control Systemexample 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 vectorsopenDDs

Close the connection from the Model Explorer to the dictionary.

hide(dictObj)

The dictionary no longer appears as a node in theModel Hierarchypane of the Model Explorer.

Close the connection from theSimulink.data.Dictionaryobject to the dictionary.

close(dictObj) cleardictObj

Input Arguments

collapse all

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

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

数据词典是开放的any of these conditions are true:

  • The dictionary appears as a node in theModel Hierarchypane of the Model Explorer. To close this connection to the dictionary, right-click the node in Model Explorer and selectClose。Alternatively, use thehidemethod of aSimulink.data.Dictionaryobject.

  • 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 theclosemethod of theSimulink.data.Dictionaryobject or clear the object. Clear theSimulink.data.dictionary.SectionandSimulink.data.dictionary.Entryobjects.

  • 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