Simulink.suppressDiagnostic
Suppress a diagnostic from a specific block
Description
Simulink.suppressDiagnostic(
suppresses all instances of diagnostics represented by source
,message_id
)message_id
thrown by
the blocks specified by source
.
Simulink.suppressDiagnostic(
suppresses
the diagnostics associated with diagnostic
)MSLDiagnostic
object diagnostic
.
Examples
Suppress a Warning Thrown by a Block
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
source
— Block or model object throwing the diagnostic
block path | block handle
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_id
— message identifier of diagnostic
message identifier | cell array of message identifiers
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
— Diagnostic object
MSLDiagnostic
object
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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)