register
コード生成アドバイザーの目的の登録
説明
例
カスタム コード生成の目的の作成
チェックを実行してパラメーター値を検証し、モデルが生成コードで使用される RAM を削減するように構成されていることを確認する Reduced RAM Example
という名前のカスタムの目的を作成します。
ファイル sl_customization.m
を作成して、カスタムの目的を作成するコールバック関数を含めます。
function sl_customization(cm) %SL_CUSTOMIZATION objective customization callback objCustomizer = cm.ObjectiveCustomizer; index = objCustomizer.addCallbackObjFcn(@addObjectives); objCustomizer.callbackFcn{index}(); end
関数 addObjectives
で目的を作成して構成します。目的の名前を設定し、検証するチェックとパラメーターを追加します。その後、目的をコード生成アドバイザーに登録します。
function addObjectives % Create the custom objective obj = rtw.codegenObjectives.Objective('ex_ram_1'); setObjectiveName(obj, 'Reduce RAM Example'); % Add parameters to the objective addParam(obj, 'InlineParams', 'on'); addParam(obj, 'BooleanDataType', 'on'); addParam(obj, 'OptimizeBlockIOStorage', 'on'); addParam(obj, 'EnhancedBackFolding', 'on'); addParam(obj, 'BooleansAsBitfields', 'on'); % Add additional checks to the objective % The Code Generation Advisor automatically includes 'Check model % configuration settings against code generation objectives' in every % objective. addCheck(obj, 'mathworks.codegen.CodeInstrumentation'); addCheck(obj, 'mathworks.codegen.UseRowMajorAlgorithm'); %Register the objective register(obj); end
入力引数
objective
— コード生成の目的
rtw.codegenObjectives.Objective
オブジェクト
コード生成の目的。rtw.codegenObjectives.Objective
オブジェクトとして指定します。
バージョン履歴
R2009a で導入
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)