Main Content

View and Revert Changes to Dictionary Data

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

View and Revert Changes to Dictionary Entries

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.

  1. Open the sldemo_fuelsys_dd_controller model.


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

  3. In the Model Explorer Model Hierarchy pane, under the External Data node, select the Design Data node for sldemo_fuelsys_dd_controller.

  4. In the Contents pane, change st_range to 0.0002 and zero_thresh to 200.

    The Status column of these entries changes to Mod, indicating that they have been modified.

  5. Click the heading of the Status column to sort the entries. Then, select the modified entries, which are indicated by the Mod status.

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

  7. In the Contents pane of the Model Explorer, right-click zero_thresh and select Revert to Saved.

    Simulink reverts zero_thresh to its value at the time of the last save action.

  8. You can merge entries between dictionaries using the Comparison Tool. From the MATLAB desktop, on the Home tab, in the File section, click Compare.

  9. Select the dictionaries to compare and merge.

  10. In the comparison report, select the merge direction for each dictionary entry.

View and Revert Changes to Entire Dictionary

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.

  1. View the example data dictionary sldemo_fuelsys_dd in Model Explorer.

    dictionary ='sldemo_fuelsys_dd.sldd');

    The dictionary contains entries that are defined in several referenced dictionaries, including sldemo_fuelsys_dd_controller and sldemo_fuelsys_dd_plant.

  2. Make some changes to sldemo_fuelsys_dd.

    section = getSection(dictionary,'Design Data');
    entry = getEntry(section,'min_throt');
    entryValue = getValue(entry);
    entryValue.DataType = 'int8';
    entryValue.Value = 4;

  3. In the Model Hierarchy pane of Model Explorer, right-click the node sldemo_fuelsys_dd and select Show Changes.

    The Comparison Tool displays the changes made to the dictionary.

  4. In the table at the top of the report, click compare in the Change Summary column of the row that corresponds to the entry min_throt.

    A new tab shows the changes made to min_throt. The script changed the parameter data type from auto to int8 and the parameter value from 3 to 4.

  5. 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 Saved.

    The entry reverts to the definition from the last saved version of the dictionary.

  6. The remaining row in the report shows that the script deleted the entry PressVect, which was defined in the referenced dictionary sldemo_fuelsys_dd_controller. Click Recover from Saved, which recovers the entry in the referenced dictionary.

  7. The table Dictionary references in sldemo_fuelsys_dd.sldd shows that the script removed the reference to the dictionary sldemo_fuelsys_dd_plant. In the Action column, click Recover Reference.

The report shows that there are no more unsaved changes to sldemo_fuelsys_dd.

Related Topics