Main Content

Close all connections to all open data dictionaries

Description attempts to close all connections to all data dictionaries that are open. For example, if you create objects, such as, that refer to a dictionary, that dictionary is open.

Some commands and functions, such as, cannot operate when dictionaries are open. It is a best practice to close each connection individually by using functions and methods such as the close method of a object. To find dictionaries that are open, use However, you can use this function to close all connections to all dictionaries.

You can also use this function to close dictionaries in a shutdown script that is part of a project. closes all connections to the dictionary named dictFileName. If you open multiple dictionaries that use this file name (for example, if the dictionaries have different file paths), the function closes all connections to all of the dictionaries.

You cannot specify dictFileName as a full file path such as 'C:\temp\myDict.sldd'.

example,unsavedAction) closes all connections to the target dictionaries by discarding or saving unsaved changes. You can choose whether to save or discard all changes to all of the target dictionaries.


collapse all

Discard any unsaved changes. All of the entries in the dictionaries revert to the last saved state.'-discard')

Open multiple connections to a data dictionary, make a change, and close all of the connections by discarding the unsaved change.

At the command prompt, open a data dictionary by creating a 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.

dictObj ='sldemo_fuelsys_dd.sldd');

Display the dictionary in the Model Explorer


You now have two connections to this dictionary: The object and the Model Explorer.

Make a change to the dictionary by adding an entry.

dDataSectObj = getSection(dictObj,'Design Data');

The object dDataSectObj is a third connection to the dictionary.

Close the connections to the dictionary. Discard the unsaved change.'sldemo_fuelsys_dd.sldd','-discard')

The dictionary no longer appears as a node in the Model Hierarchy pane of the Model Explorer. The object dictObj is disconnected from the dictionary. You cannot interact with the dictionary by using the object dDataSectObj.

Clear the objects that referred to the dictionary.

clear dictObj dDataSectObj

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

Action for unsaved changes, specified as '-discard' (to discard changes) or '-save' (to save changes). If you call without the unsavedAction argument, Simulink® reports an error if the data dictionary has unsaved changes.


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 object.

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




    To close these connections to the dictionary, use the close method of the object or clear the object. Clear the and 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