This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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 add a comment for the suppressed diagnostic. You can restore the diagnostic by clicking Restore.

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 | string

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 lastwarn function.

Data Types: char | string

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 and time 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 added or edited 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
suppressSuppress diagnostic specified by Simulink.SuppressedDiagnostic object

Copy Semantics

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

Examples

collapse all

Using the model from Suppress 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