Close all connections to all open data dictionaries
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
Simulink.data.Dictionary object. To find dictionaries
that are open, use
However, you can use this function to close all connections to all
You can also use this function to close dictionaries in a shutdown script that is part of a project.
all connections to the dictionary named
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
Close All Connections to All Open Dictionaries
Discard any unsaved changes. All of the entries in the dictionaries revert to the last saved state.
Close All Connections to Single Data Dictionary
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
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
You now have two connections to this dictionary: The
and the Model Explorer.
Make a change to the dictionary by adding an entry.
dDataSectObj = getSection(dictObj,'Design Data'); addEntry(dDataSectObj,'myEntry',5.2);
a third connection to the dictionary.
Close the connections to the dictionary. Discard the unsaved change.
The dictionary no longer appears as a node in the Model
Hierarchy pane of the Model Explorer. The
disconnected from the dictionary. You cannot interact with the dictionary
by using the
Clear the objects that referred to the dictionary.
clear dictObj dDataSectObj
dictFileName — File name of target data dictionary or dictionaries
File name of target data dictionary or dictionaries, specified
as a character vector. Use the file extension
unsavedAction — Action for unsaved changes
Action for unsaved changes, specified as
discard changes) or
'-save' (to save 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
hidemethod of a
You created an object of any of these classes that refer to the dictionary:
To close these connections to the dictionary, use the
closemethod of the
Simulink.data.Dictionaryobject or clear the object. Clear the
A model that is linked to the dictionary is open. To close this connection to the dictionary, close the model.
Introduced in R2016a