Simulink block warning suppression for identifier 'Simulink:blocks:AssertionAssert' does not work.
9 次查看(过去 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 中查找有关 Programmatic Model Editing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!