Suppress diagnostic messages from a specified block
Simulink.SuppressedDiagnostic object contains information related to
diagnostic warnings or errors that are suppressed from being thrown during
The Diagnostic Viewer in Simulink® includes an option to suppress certain diagnostics. This feature enables
you to suppress warnings or errors for specific objects in your model. Click the
Suppress button next to the warning in the Diagnostic Viewer
to suppress the warning from the specified source. This action creates a
Simulink.SuppressedDiagnostic object. You can access this object
at the MATLAB® command line using the
Simulink.getSuppressedDiagnostics function. You can add a comment for
the suppressed diagnostic. You can restore the diagnostic by clicking
creates a suppressed diagnostic object. The object suppresses all instances of
diagnostics represented by
DiagnosticObject = Simulink.SuppressedDiagnostic(
message_id thrown by the blocks specified
source— System, block, or model object throwing diagnostic
message_id— message identifier of diagnostic
The message identifier of the diagnostic, specified as a character
vector or string. You can find the message identifier of diagnostics
thrown during simulation by accessing the
ExecutionInfo property of the
Simulink.SimulationMetadata object associated with a
simulation. You can also use the
Comments— Comments associated with the suppression object
Comments associated with the suppression object, specified as a character vector. This property is optional.
ID— Message identifier of the diagnostic that was suppressed
The message identifier of the diagnostic that was suppressed, specified as a character vector.
LastModified— Date and time the suppression object was last modified
Date and time the suppression object was last modified, specified as a character vector. This property is read-only.
LastModifiedBy— Name of the user who was last to add or edit the suppression object
Name of the user who last added or edited the suppression object, specified as a character vector. This property is optional.
Source— block path of the source of the diagnostic
The block path of the model object that has a suppressed diagnostic, specified as a character vector.
|restore||Remove specified diagnostic suppressions|
|suppress||Suppress diagnostic specified by
Handle. To learn how handle classes affect copy operations, see Copying Objects (MATLAB).
Using the model from Suppress Diagnostic Messages Programmatically, create and then restore a diagnostic suppression.
suppress the parameter precision loss warning thrown by the Constant block,
suppression = Simulink.SuppressedDiagnostic('Suppressor_CLI_Demo/one',... 'SimulinkFixedPoint:util:fxpParameterPrecisionLoss');
The parameter precision loss warning is no longer thrown in future simulations of this model.
Add accountability information to the object by editing
of the object.
suppression.LastModifiedBy = 'John Doe'; suppression.Comments = 'Reviewed: Joe Schmoe'
suppression = SuppressedDiagnostic with properties: Source: 'Suppressor_CLI_Demo/one' Id: 'SimulinkFixedPoint:util:fxpParameterPrecisionLoss' LastModifiedBy: 'John Doe' Comments: 'Reviewed: Joe Schmoe' LastModified: '2016-Jun-01 17:25:21'
You can restore the diagnostic using the