How do I make a Simulink build fail if warnings are present?

2 ビュー (過去 30 日間)
Jonathan Enz
Jonathan Enz 2022 年 4 月 5 日
回答済み: Lokesh 2023 年 9 月 22 日
I'm using the rtwbuild('MyModel.slx'); command to build my model in a script. I'd like to have a configuration available to make the build fail if there are warnings.
In other words, what is the -Werror equivalent when building a Simulink model?

回答 (1 件)

Lokesh
Lokesh 2023 年 9 月 22 日
Hi Jonathon,
I understand that you want the Simulink build to fail when a warning is present.
In Simulink, warnings are considered as advisory messages and do not cause the build process to fail by default. However, there is a workaround to achieve this by modifying the configuration settings.
  • In the Simulink toolbar, click on the Modeling tab and go to Model Settings (Configuration Parameters).
  • Navigate to the Diagnostics tab in the configuration dialog.
  • In In the list of checks, locate the checks related to the warnings you want to treat as errors.
  • For each check you want to treat as an error, select it and change the "Action" to "Error".
  • Click "OK" to save the configuration.
  • Now, when you build your Simulink model using the “rtwbuild” command, the Model Advisor checks will be performed, and any warnings that were configured to be treated as errors will cause the build to fail.
By configuring the settings to treat specific warnings as errors, you can achieve a similar effect to the "-Werror" flag.
I hope the above workaround resolves your issue.

カテゴリ

Help Center および File ExchangeDeployment, Integration, and Supported Hardware についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by