Main Content

saveChanges

データ ディクショナリに対する変更を保存

説明

saveChanges(dictionaryObj) は、データ ディクショナリ dictionaryObj (Simulink.data.Dictionary オブジェクト) に対して行われたすべての変更を保存します。saveChanges では、参照データ ディクショナリに対する変更も保存されます。ターゲットのディクショナリおよびその参照ディクショナリの以前の状態は完全に失われます。

すべて折りたたむ

新しいデータ ディクショナリ myNewDictionary.sldd を作成し、[Design Data] セクションを dDataSectObj という名前の Simulink.data.dictionary.Section オブジェクトで表します。

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

  data dictionary with properties:

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

値が 237myNewEntry というエントリを追加することで myNewDictionary.sldd を変更します。myDictionaryObjHasUnsavedChanges プロパティを表示して、変更が行われたことを確認します。

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

  Dictionary with properties:

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

myNewDictionary.sldd に対する変更をすべて保存します。myDictionaryObjHasUnsavedChanges プロパティで、変更が保存されたことを確認します。

saveChanges(myDictionaryObj)
myDictionaryObj
myDictionaryObj = 

  Dictionary with properties:

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

入力引数

すべて折りたたむ

ターゲットのデータ ディクショナリ。Simulink.data.Dictionary オブジェクトとして指定します。この関数を使用する前に、関数 Simulink.data.dictionary.create や関数 Simulink.data.dictionary.open を使用してターゲットのディクショナリを Simulink.data.Dictionary オブジェクトで表しておきます。

代替方法

モデル エクスプローラーの [モデルの階層構造] ペインで、ディクショナリ ツリー ノードを右クリックして [変更の保存] を選択すると、データ ディクショナリに対する変更を保存することができます。

バージョン履歴

R2015a で導入