Main Content

saveChanges

Save changes to data dictionary

Description

example

saveChanges(dictionaryObj) saves all changes made to a data dictionary dictionaryObj, a Simulink.data.Dictionary object. saveChanges also saves changes made to referenced data dictionaries. The previous states of the target dictionary and its referenced dictionaries are permanently lost.

Examples

collapse all

Create a new data dictionary myNewDictionary.sldd and represent the Design Data section with a Simulink.data.dictionary.Section object named dDataSectObj.

myDictionaryObj = Simulink.data.dictionary.create('myNewDictionary.sldd')
dDataSectObj = getSection(myDictionaryObj,'Design Data');
myDictionaryObj = 

  data dictionary with properties:

          DataSources: {0x1 cell}
    HasUnsavedChanges: 0
           NumberOfEntries: 0

Change myNewDictionary.sldd by adding an entry named myNewEntry with value 237. View the HasUnsavedChanges property of myDictionaryObj to confirm a change was made.

addEntry(dDataSectObj,'myNewEntry',237);
myDictionaryObj
myDictionaryObj = 

  Dictionary with properties:

          DataSources: {0x1 cell}
    HasUnsavedChanges: 1
           NumberOfEntries: 1

Save all changes to myNewDictionary.sldd. The HasUnsavedChanges property of myDictionaryObj indicates changes were saved.

saveChanges(myDictionaryObj)
myDictionaryObj
myDictionaryObj = 

  Dictionary with properties:

          DataSources: {0x1 cell}
    HasUnsavedChanges: 0
           NumberOfEntries: 1

Input Arguments

collapse all

Target data dictionary, specified as a Simulink.data.Dictionary object. Before you use this function, represent the target dictionary with a Simulink.data.Dictionary object by using, for example, the Simulink.data.dictionary.create or Simulink.data.dictionary.open function.

Alternatives

You can use Model Explorer to save changes to a data dictionary by right-clicking on the dictionary tree node in the Model Hierarchy pane and selecting Save Changes.

Introduced in R2015a