Documentation

Simulink.SuppressedDiagnostic class

Package: Simulink

Suppress diagnostic messages from a specified block

Description

A Simulink.SuppressedDiagnostic object contains information related to diagnostic warnings or errors that are suppressed from being thrown during simulation.

Construction

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 restore the diagnostic by clicking Restore this warning.

DiagnosticObject = Simulink.SuppressedDiagnostic(source, message_id) creates a suppressed diagnostic object. The object suppresses all instances of diagnostics represented by message_id thrown by the blocks specified by source.

Input Arguments

expand all

The source of the diagnostic, specified as a model, subsystem, block path, block handle, cell array of block paths, or cell array of block handles.

To get the block path, use the gcb function.

To get the block handle, use the getSimulinkBlockHandle function.

Data Types: char | cell

The message identifier of the diagnostic, specified as a character vector or a cell array of character vectors. 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 lastwarn function.

Data Types: char | cell

Properties

expand all

Comments associated with the suppression object, specified as a character vector. This property is optional.

Data Types: char

The message identifier of the diagnostic that was suppressed, specified as a character vector.

Data Types: char

Date the suppression object was last modified, specified as a character vector. This property is read-only.

Data Types: char

Name of the user who last to add or edit the suppression object, specified as a character vector. This property is optional.

Data Types: char

The block path of the model object that has a suppressed diagnostic, specified as a character vector.

Data Types: char

Methods

restoreRemove specified diagnostic suppressions

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects (MATLAB).

Examples

expand all

Using the model fromSuppress Diagnostic Messages Programmatically, create and then restore a diagnostic suppression.

Create a Simulink.SuppressedDiagnostic object, suppression to suppress the parameter precision loss warning thrown by the Constant block, one.

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 the LastModifiedBy and Comments properties 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 restore method.

restore(suppression);

Introduced in R2016b

Was this topic helpful?