メインコンテンツ

選択したモデル アドバイザー チェックの実行とレポートの生成

この例では、Simulink モデルに対して選択したモデル アドバイザー チェックをプログラムによって実行し、個々のチェックの結果を取得して、その結果をまとめた HTML レポートを生成する方法を示します。このワークフローの例では、モデル内の未接続のラインと単位の不一致をチェックし、潜在的なモデル化の問題および複雑度を特定するのに役立てます。

モデル例を開きます。

model = "sldemo_mdladv";
open_system(model);

Create a Model Advisor object for the system:

ma = Simulink.ModelAdvisor.getModelAdvisor(model);
Updating Model Advisor cache...
Model Advisor cache updated. For new customizations, to update the cache, use the Advisor.Manager.refresh_customizations method.

Specify the Model Advisor checks to run by their IDs.

selectedCheck = {'mathworks.design.UnitMismatches','mathworks.design.UnconnectedLinesPorts'};

Run the Model Advisor checks.

a = runCheck(ma,selectedCheck);

Set the destination file for the report.

destination = fullfile(pwd,"AdvisorExport.html");

レポートをエクスポートし、出力とメッセージを取得します。

[output,message] = exportReport(ma,destination);

結果を表示します。

if output
    fprintf("Report exported successfully: %s\n",message);
else
    fprintf("Report export failed: %s\n",message);
end
Report exported successfully: 

参考

|

トピック