Main Content

Simulink.suppressDiagnostic

Suppress a diagnostic from a specific block

Description

Simulink.suppressDiagnostic(source,message_id) suppresses all instances of diagnostics represented by message_id thrown by the blocks specified by source.

example

Simulink.suppressDiagnostic(diagnostic) suppresses the diagnostics associated with MSLDiagnostic object diagnostic.

Examples

collapse all

Suppress diagnostic warnings thrown by a block of a Simulink® model.

Load the model Suppressor_CLI_Demo.

model = 'Suppressor_CLI_Demo';
load_system(model);

To access Simulink.SimulationMetadata class, set the ReturnWorkspaceOutputs parameter value to 'on'.

set_param(model,'ReturnWorkspaceOutputs','on');

Simulate the model.

out1 = sim(model);
Warning: Parameter precision loss occurred for 'Value' of 'Suppressor_CLI_Demo/one'.  The original value of the parameter, 0.01, cannot be represented exactly using the run-time data type sfix16_En5. The value is quantized to 0. Quantization error occurred with an absolute difference of 0.01 and a relative difference of 1. 
Suggested Actions:
    • To control the level of precision loss at which a warning or error is issued, adjust the diagnostic threshold settings. - Open
    • Inspect details in the Parameter Quantization Advisor. - Open
    •  - Suppress

Warning: Parameter underflow occurred for 'Value' of 'Suppressor_CLI_Demo/one'.  The value of the parameter, 0.01, is non-zero, but after quantization to the run-time data type sfix16_En5, the value is zero (0). Quantization error occurred with an absolute difference of 0.01 and a relative difference of 1. 
Suggested Actions:
    • Inspect details in the Parameter Quantization Advisor. - Open
    •  - Suppress

Warning: Saturate on overflow detected. This originated from 'Suppressor_CLI_Demo/Convert/FixPt To FixPt1'
Suggested Actions:
    •  - Suppress

Warning: Saturate on overflow detected. This originated from 'Suppressor_CLI_Demo/Convert/FixPt To FixPt2'
Suggested Actions:
    •  - Suppress

Warning: Saturate on overflow detected. This originated from 'Suppressor_CLI_Demo/Convert/FixPt To FixPt3'
Suggested Actions:
    •  - Suppress

Suppress the parameter precision loss warning thrown by the Constant block one.

Simulink.suppressDiagnostic('Suppressor_CLI_Demo/one',...
     'SimulinkFixedPoint:util:fxpParameterPrecisionLoss');

The getDiagnosticObjects.m function queries the simulation metadata to access diagnostics that were thrown during simulation. The suppressor_script.m contains the commands for suppressing and restoring diagnostics to Suppressor_CLI_Demo.

Simulate the model.

out2 = sim(model);
Warning: Parameter underflow occurred for 'Value' of 'Suppressor_CLI_Demo/one'.  The value of the parameter, 0.01, is non-zero, but after quantization to the run-time data type sfix16_En5, the value is zero (0). Quantization error occurred with an absolute difference of 0.01 and a relative difference of 1. 
Suggested Actions:
    • Inspect details in the Parameter Quantization Advisor. - Open
    •  - Suppress

Warning: Saturate on overflow detected. This originated from 'Suppressor_CLI_Demo/Convert/FixPt To FixPt1'
Suggested Actions:
    •  - Suppress

Warning: Saturate on overflow detected. This originated from 'Suppressor_CLI_Demo/Convert/FixPt To FixPt2'
Suggested Actions:
    •  - Suppress

Warning: Saturate on overflow detected. This originated from 'Suppressor_CLI_Demo/Convert/FixPt To FixPt3'
Suggested Actions:
    •  - Suppress

The parameter precision loss warning is suppressed.

Input Arguments

collapse all

The source of the diagnostic, specified as a 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

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

Diagnostic specified as an MSLDiagnostic object. Access the MSLDiagnostic object through the ExecutionInfo property of the Simulink.SimulationMetadata object.

Data Types: struct

Version History

Introduced in R2016b