Borrar filtros
Borrar filtros

Simulink block warning suppression for identifier 'Simulink:​blocks:Ass​ertionAsse​rt' does not work.

12 visualizaciones (últimos 30 días)
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:
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?

Respuestas (1)

Pavan Guntha
Pavan Guntha el 15 de Nov. de 2021
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
% 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!
  1 comentario
Piotr Kluczek
Piotr Kluczek el 9 de Dic. de 2021
Hello Pavan,
I already knew that - if I disable Assertion I will not get a warning. I could even do that without the script anyway.
But I will not get the verify() alike behavior either, so that is not the point
Maybe you will come up with other ideas.

Iniciar sesión para comentar.


Más información sobre Test Execution en Help Center y File Exchange.




Community Treasure Hunt

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

Start Hunting!

Translated by