Simulink block warning suppression for identifier 'Simulink:blocks:AssertionAssert' does not work.
조회 수: 11 (최근 30일)
이전 댓글 표시
Hello,
I am trying to use Simulink/Model Verification/Assertion block with Simulink Test because it is treated like a verify() function and In fact it does not require Simulink Test license, so other team members can still benefit from that.
The only drawback is that it produces warning every time the assertion fails and reports are spammed with those. Then I would like to suppress the warning. This works:
warning('off', 'Simulink:blocks:AssertionAssert')
but for all asserts in this Matlab session. There is selective suppression per block:
Simulink.suppressDiagnostic(gcb,'Simulink:blocks:AssertionAssert')
but it results in error: "The message identifier Simulink:blocks:AssertionAssert cannot be suppressed.". This is the same answer for all unknown identifiers. Is there another way to do that?
댓글 수: 0
답변 (1개)
Pavan Guntha
2021년 11월 15일
Hello Piotr,
You could supress the warnings from Assertion blocks in a Simulink model by disabling the Assertion for those blocks. The following example illustrates this process. Consider the following model (assertion_blocks.slx) where there are 2 assertion blocks:
In order to suppress the assertion warnings from these blocks, the following can be done:
% Open the Simulink model
open_system('assertion_blocks')
% Find all the Assertion blocks in the model
list = find_system('SearchDepth',1,'BlockType','Assertion')
% Set the 'enabled' property of the Assertion blocks to 'off'
set_param(list{1}, 'enabled', 'off') % Suppress warnings from 'Assertion' block
set_param(list{2}, 'enabled', 'off') % Suppress warnings from 'Assertion1' block
In this manner you could suppress the warnings from few specific Assertion blocks as required.
For more information, you could look at the documentation pages of find_system, set_param and assertion.
Hope this helps!
참고 항목
카테고리
Help Center 및 File Exchange에서 Test Execution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!