- Add the following command to the "PreLoadFcn" callback of your top-level model: old_warning_state = warning('off', '<warning ID>');
- To restore the previous warning state after the simulation stops, add the following command to the "StopFcn" callback: warning(old_warning_state);
How to selectively suppress warnings displayed for a model in the Simulink Diagnostic Viewer in Simulink R2024b?
조회 수: 4 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2025년 11월 4일 0:00
답변: MathWorks Support Team
2025년 11월 7일 21:02
I am running a model in MATLAB R2024b that triggers multiple warnings in the Diagnostic Viewer. I would like to suppress all instances of one of the warnings. I did not find any parameter under Model Settings -> Diagnostics that controls the particular warning I am interested in.
Is there any other way to suppress specific warnings?
채택된 답변
MathWorks Support Team
2025년 11월 4일 0:00
You can suppress diagnostic messages programmatically using the "simulink.suppressdiagnostic" function. However, this function may not work for all diagnostic warnings, in which case, you will get the following message:
The message identifier <warning ID> cannot be suppressed.
For these warnings, you can use the following workaround that utilizes Model Callbacks:
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Configure and View Diagnostics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!