このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
coder.asap2.Function
説明
関数オブジェクトを作成して、関数の説明を定義して ASAP2 ファイルにエクスポートします。
作成
は関数オブジェクトを作成します。このオブジェクトを使用して、新しい関数の説明を定義して ASAP2 ファイルにエクスポートできます。userFunction
= coder.asap2.Function
プロパティ
次の表に Function
オブジェクトのフィールドを示します。
要素 | 説明 |
---|---|
名前 | 関数の名前 |
LongIdentifier | 説明またはコメント |
FunctionVersion | 関数のバージョン |
注釈 | 複数行の ASCII 説明テキストとして表された一連のメモ |
InMeasurements | 入力測定値の配列 |
OutMeasurements | 出力測定値の配列 |
LocMeasurements | ローカル測定値の配列 |
DefCharacteristics | 定義済み特性の配列 |
RefCharacteristics | 基準特性の配列 |
SubFunctions | サブ関数の配列 |
例
カスタム関数の作成と追加
この例では、カスタム関数を ASAP2 ファイルに追加する方法について説明します。
ECU 説明オブジェクトの作成
モデルを開いてビルドし、ECU 説明オブジェクトを作成します。
open_system("ASAP2Demo") rtwbuild("ASAP2Demo")
### Starting serial model reference code generation build. ### Successfully updated the model reference code generation target for: ASAP2DemoModelRef ### Starting build procedure for: ASAP2Demo ### Successful completion of build procedure for: ASAP2Demo Build Summary Code generation targets built: Model Action Rebuild Reason ====================================================================================== ASAP2DemoModelRef Code generated and compiled. ASAP2DemoModelRef.c does not exist. Top model targets built: Model Action Rebuild Reason =========================================================================================== ASAP2Demo Code generated and compiled. Code generation information file does not exist. 2 of 2 models built (0 models already up to date) Build duration: 0h 0m 43.404s
descObj=coder.asap2.getEcuDescriptions("ASAP2Demo")
descObj = Data with no properties.
カスタム関数の作成
関数オブジェクト テンプレートを作成し、必要なフィールドを追加します。
userFunction = coder.asap2.Function
userFunction = Function with properties: Name: "undefined" FunctionVersion: [1x0 char] LongIdentifier: [1x0 char] Annotation: [1x0 char] InMeasurements: [1x0 string] OutMeasurements: [1x0 string] LocMeasurements: [1x0 string] DefCharacteristics: [1x0 string] RefCharacteristics: [1x0 string] SubFunctions: [1x0 string]
userFunction.Name = 'Custom_Function1'
userFunction = Function with properties: Name: 'Custom_Function1' FunctionVersion: [1x0 char] LongIdentifier: [1x0 char] Annotation: [1x0 char] InMeasurements: [1x0 string] OutMeasurements: [1x0 string] LocMeasurements: [1x0 string] DefCharacteristics: [1x0 string] RefCharacteristics: [1x0 string] SubFunctions: [1x0 string]
userFunction.LongIdentifier = 'Custom Function by user'
userFunction = Function with properties: Name: 'Custom_Function1' FunctionVersion: [1x0 char] LongIdentifier: 'Custom Function by user' Annotation: [1x0 char] InMeasurements: [1x0 string] OutMeasurements: [1x0 string] LocMeasurements: [1x0 string] DefCharacteristics: [1x0 string] RefCharacteristics: [1x0 string] SubFunctions: [1x0 string]
ASAP2 ファイルへの関数のエクスポート
関数を ECU 説明オブジェクトに追加し、説明オブジェクトを使用して ASAP2 ファイルを生成します。
add(descObj,userFunction)
coder.asap2.export("ASAP2Demo",CustomEcuDescriptions=descObj)
Following Characteristics or Measurements with unsupported data types are not exported in ASAP2 file. "ASAP2Demo_DW.ASAP2DemoModelRef_InstanceData"
バージョン履歴
R2022b で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)