Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

coder.dictionary.create

Embedded Coder ディクショナリおよび coder.Dictionary オブジェクトを作成

R2019b 以降

説明

coderDictionaryObj = coder.dictionary.create(sourceName) は、sourceName で識別されるモデルまたは Simulink® データ ディクショナリに Embedded Coder ディクショナリを作成します。この関数は、新しい Embedded Coder ディクショナリを表す coder.Dictionary オブジェクトを返します。Embedded Coder ディクショナリはデータ インターフェイス構成タイプを使用します。

ソースのモデルまたはデータ ディクショナリに既に Embedded Coder ディクショナリがある場合は、coder.dictionary.open を使用して coder.Dictionary オブジェクトにアクセスします。Embedded Coder ディクショナリは、Embedded Coder アプリでモデルを開くか、モデルまたはデータ ディクショナリの [Embedded Coder ディクショナリ] ダイアログ ボックスを開くと作成されます。

coderDictionaryObj = coder.dictionary.create(sourceName,interfaceType) は、指定したコード インターフェイス タイプを使用する Embedded Coder ディクショナリを作成します。次の構文を使用することで、データ インターフェイス構成またはサービス インターフェイス構成のいずれかを使用する Embedded Coder ディクショナリを作成できます。 (R2023b 以降)

すべて折りたたむ

データ ディクショナリを作成します。

dataDictionary = Simulink.data.dictionary.create('DataDictionary.sldd');

データ ディクショナリに Embedded Coder ディクショナリを作成します。

coderDictionary = coder.dictionary.create(dataDictionary);
coderDictionary = 

  Dictionary with Sections:

                    StorageClasses: [1×1 coder.dictionary.Section]
                    MemorySections: [1×1 coder.dictionary.Section]
    FunctionCustomizationTemplates: [1×1 coder.dictionary.Section]

Embedded Coder ディクショナリを保存するデータ ディクショナリを作成します。

dataDictionary = Simulink.data.dictionary.create('DataDictionary.sldd');

データ ディクショナリに Embedded Coder ディクショナリを作成します。サービス インターフェイス構成タイプを指定します。

coderDictionary = coder.dictionary.create(dataDictionary,'ServiceInterface');
coderDictionary = 

  Dictionary with properties and Sections:

               ServicesHeaderFileName: 'services.h'
                    InitTermFunctions: [1×1 coder.dictionary.Section]
           PeriodicAperiodicFunctions: [1×1 coder.dictionary.Section]
               DataReceiverInterfaces: [1×1 coder.dictionary.Section]
                 DataSenderInterfaces: [1×1 coder.dictionary.Section]
               DataTransferInterfaces: [1×1 coder.dictionary.Section]
                      TimerInterfaces: [1×1 coder.dictionary.Section]
            ParameterTuningInterfaces: [1×1 coder.dictionary.Section]
    ParameterArgumentTuningInterfaces: [1×1 coder.dictionary.Section]
                MeasurementInterfaces: [1×1 coder.dictionary.Section]
           SubcomponentEntryFunctions: [1×1 coder.dictionary.Section]
               SharedUtilityFunctions: [1×1 coder.dictionary.Section]
                       StorageClasses: [1×1 coder.dictionary.Section]
                   DataMemorySections: [1×1 coder.dictionary.Section]
               FunctionMemorySections: [1×1 coder.dictionary.Section]

これで、ディクショナリのセクションにアクセスし、セクションを使用してサービス インターフェイス定義を追加および編集できるようになりました。

入力引数

すべて折りたたむ

ターゲットのモデル ファイルまたはデータ ディクショナリの名前。文字ベクトル、string スカラー、または Simulink.data.Dictionary オブジェクトとして指定します。

  • モデルは、読み込み済み (たとえば load_system を使用) であるか開いていなければなりません。

    ファイル拡張子 .slx を指定する必要はありません。

  • ディクショナリは、モデル エクスプローラーで開いているか、現在のフォルダーまたは MATLAB® パス上になければなりません。

    ファイル拡張子 .sldd を指定する必要があります。

例: 'myLoadedModel'

例: 'myDictionary.sldd'

データ型: char

R2023b 以降

コード インターフェイス構成タイプ。'DataInterface' または 'ServiceInterface' として指定します。sourceName が Simulink モデルの場合、interfaceType'DataInterface' でなければなりません。

生成されたコードの展開方法を考慮してコード インターフェイス構成タイプを選択します。

  • データ インターフェイス構成 — ターゲット デバイスで実行することを目的としたプログラムがコード ジェネレーターで作成されます。定義したデータ インターフェイスが生成コードで使用されます。

  • サービス インターフェイス構成 — より大きなアプリケーション内で展開することを目的としたアルゴリズムがコード ジェネレーターで作成されます。プラットフォーム ミドルウェアでアルゴリズムのコードが呼び出され、ターゲット デバイス向けのサービスが提供されます。サービス インターフェイス構成の定義に従って生成コードでサービスが呼び出されます。サービス インターフェイス構成を作成するには、Simulink データ ディクショナリに格納された Embedded Coder ディクショナリを使用する必要があります。

例: 'ServiceInterface'

データ型: char

出力引数

すべて折りたたむ

新しい Embedded Coder ディクショナリ。coder.Dictionary オブジェクトとして返されます。

バージョン履歴

R2019b で導入

すべて展開する