A Simulink® data dictionary permanently stores model data including MATLAB® variables, data objects, and data types. For basic information about data dictionaries, see What Is a Data Dictionary?.
This example shows how to view unsaved changes to dictionary entries, who made them, and when. You can view changes to entries in any section, including data stored in the Other Data section and configuration sets stored in the Configurations section.
Open the data dictionary linked to this model. Click the model data badge in the bottom left corner of the model, then click the External Data link.
In the Model Explorer Model Hierarchy pane,
under the External Data node, select the
Design Data node for
In the Contents pane, change
The Status column of these entries changes to
Mod, indicating that they have been
Click the heading of the Status column to
sort the entries. Then, select the modified entries, which are
indicated by the
Right-click and select Show Changes.
The Comparison Tool appears, displaying changed entries in separate tabs. The tool highlights changed values.
The Comparison Tool does not display changes to the data dictionary property Enable dictionary access to base workspace.
In the Contents pane of the Model Explorer,
zero_thresh and select
Revert to Saved.
zero_thresh to its value at the time of the
last save action.
You can merge entries between dictionaries using the Comparison Tool. From the MATLAB desktop, on the Home tab, in the File section, click Compare.
Select the dictionaries to compare and merge.
In the comparison report, select the merge direction for each dictionary entry.
If you store model variables in a data dictionary, you can view and manage the changes that you make while you work. You can use the Comparison Tool to see the changes made to a dictionary, which compares the modified dictionary with the most recent saved version.
When you view the changes to a dictionary, you can choose to discard changes to individual entries or dictionary references, which reverts to the last saved state. You can use this technique to recover entries that you delete in your modified version or dictionary references that you remove.
If you view changes to a dictionary that references other dictionaries, the Comparison Tool also reports changes made to the entries in the referenced dictionaries.
View the example data dictionary
in Model Explorer.
dictionary = Simulink.data.dictionary.open('sldemo_fuelsys_dd.sldd'); show(dictionary)
The dictionary contains entries that are defined in several referenced
Run the script
ex_dictionary_changes, which makes changes to
sldemo_fuelsys_dd. Later, you can use the
Comparison Tool to investigate the changes.
In the Model Hierarchy pane of Model Explorer,
right-click the node
sldemo_fuelsys_dd and select
The Comparison Tool displays the changes made to the dictionary.
In the table at the top of the report, click
compare in the Change Summary column of the row
that corresponds to the entry
A new tab shows the changes made to
script changed the parameter data type from
int8 and the parameter value from
Click the tab that shows the changes made to the dictionary. In the
Action column of the row that corresponds to the entry
min_throt, click Revert to
The entry reverts to the definition from the last saved version of the dictionary.
The remaining row in the report shows that the script deleted the
PressVect, which was defined in the referenced
Recover from Saved, which recovers the entry in
the referenced dictionary.
The table Dictionary references in
sldemo_fuelsys_dd.sldd shows that the script removed the
reference to the dictionary
In the Action column, click Recover
The report shows that there are no more unsaved changes to