Main Content

ディクショナリ データの変更表示と変更取り消し

Simulink® データ ディクショナリは、MATLAB® 変数、データ オブジェクト、データ型などのモデル データを永続的に保存します。データ ディクショナリの基本的な情報は、データ ディクショナリとはを参照してください。

ディクショナリのエントリの変更表示と変更取り消し

この例では、ディクショナリのエントリへの保存されていない変更と誰がいつ変更を加えたかを表示する方法を示します。[Other Data] セクションに格納されているデータおよび [Configurations] セクションに格納されているコンフィギュレーション セットを含む、すべてのセクション内のエントリに対する変更を表示できます。

  1. sldemo_fuelsys_dd_controller モデルを開きます。

    openExample('simulink_automotive/UseDDForFuelContSysExample','supportingfile','sldemo_fuelsys_dd_controller')

  2. このモデルにリンクされたデータ ディクショナリを開きます。モデルの左下隅でモデルのデータ バッジ をクリックし、[外部データ] リンクをクリックします。

  3. モデル エクスプローラーの [モデルの階層構造] ペインで、[外部データ] ノードの下にある sldemo_fuelsys_dd_controller[データの設計] ノードを選択します。

  4. [コンテンツ] ペインで、st_range0.0002 に変更し、zero_thresh200 に変更します。

    これらのエントリの [Status] 列が Mod に変更され、エントリが変更されたことを示します。

  5. [Status] 列の見出しをクリックして、エントリを並べ替えます。次に、Mod ステータスで示されている変更したエントリを選択します。

    View of Model Explorer. In the Model Hierarchy pane, the Design Data node of data dictionary is selected. In the Contents pane, two modified entries in the data dictionary are selected. The context menu for the entries has the Show Changes menu item selected.

  6. 右クリックして [変更を表示] を選択します。

    変更したエントリを個別のタブに表示する比較ツールが表示されます。このツールでは、変更した値が強調表示されます。

    Comparison Tool dialog box with the Comparison tab open on the toolstrip. The Comparison tab has a tab for each of the changed entries. The changed values are highlighted.

    メモ

    比較ツールでは、データ ディクショナリのプロパティ [ディクショナリからベース ワークスペースへのアクセスを有効にする] への変更が表示されません。

  7. モデル エクスプローラーの [コンテンツ] ペインで、zero_thresh を右クリックし、[保存された内容に戻す] を選択します。

    Simulink は、最後の保存アクション時に zero_thresh をその値に戻します。

  8. 比較ツールを使用して、ディクショナリ間のエントリを結合できます。MATLAB デスクトップの [ホーム] タブの [ファイル] セクションで、[比較] をクリックします。

  9. 比較および結合するディクショナリを選択します。

    Select Files or Folders for Comparison dialog box. Two data dictionaries are selected for comparison. The Comparison type is set to "Comparison of files with extension (.sldd)".

  10. 比較レポートで、各ディクショナリ エントリの結合方向を選択します。

    A dictionary file comparison report. Each row in the report compares a variable entry in one dictionary to the same variable in the other dictionary. Buttons at the end of the row allow you to select the merge direction for the entry.

ディクショナリ全体の変更表示と変更取り消し

モデル変数をデータ ディクショナリに格納する場合、作業中に行った変更を表示し、管理できます。比較ツールを使用してディクショナリの変更を表示し、変更したディクショナリを最後に保存したバージョンと比較できます。

ディクショナリの変更を表示すると、個々のエントリまたはディクショナリ参照への変更を破棄し、最後に保存された状態に戻すことができます。この手法を使用して、修正バージョンで削除したエントリまたはディクショナリ参照を復元できます。

他のディクショナリを参照するディクショナリの変更を表示する場合、比較ツールは参照されたディクショナリのエントリへの変更もレポートします。

  1. モデル エクスプローラーでデータ ディクショナリの例 sldemo_fuelsys_dd を表示します。

    dictionary = Simulink.data.dictionary.open('sldemo_fuelsys_dd.sldd');
    show(dictionary)

    ディクショナリには、いくつかの参照ディクショナリで定義された sldemo_fuelsys_dd_controllersldemo_fuelsys_dd_plant などのエントリが含まれます。

  2. sldemo_fuelsys_dd に変更を加えます。

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

  3. モデル エクスプローラーの [モデルの階層構造] ペインで、sldemo_fuelsys_dd ノードを右クリックして [変更を表示] を選択します。

    比較ツールに、ディクショナリに対する変更内容が表示されます。

    Comparison tool that displays changes to a data dictionary. The first column displays saved entries in the data dictionary. The second column displays unsaved changes to those entries. The third column displays a change summary, a last modified timestamp, and a clickable action you can take to recover or revert changes. Below this table is a table of Dictionary references The first column displays saved references. The second column displays unsaved changes. The third column displays a change summary and a clickable action you can take to recover a reference.

  4. レポート上部のテーブルで、エントリ min_throt に対応する行の [変更概要] 列で [比較] をクリックします。

    新しいタブに、min_throt に対する変更内容が表示されます。スクリプトで、パラメーターのデータ型が auto から int8 に変更され、パラメーター値が 3 から 4 に変更されています。

  5. ディクショナリへの変更を表示するタブをクリックします。エントリ min_throt に対応する行の [アクション] 列で、[保存された内容に戻す] をクリックします。

    エントリは、最後に保存されたディクショナリのバージョンの定義に戻ります。

  6. レポートの残りの行に、参照ディクショナリ sldemo_fuelsys_dd_controller で定義されたエントリ PressVect がスクリプトから削除されたことが示されます。[保存された内容から復元] をクリックすると、参照ディクショナリのエントリが復元されます。

  7. [sldemo_fuelsys_dd.sldd のディクショナリ参照] テーブルに、ディクショナリ sldemo_fuelsys_dd_plant への参照がスクリプトから削除されたことが示されます。[アクション] 列で、[参照の復元] をクリックします。

レポートに、sldemo_fuelsys_dd に対する未保存の変更がないことが示されます。

関連するトピック