Simulink.suppressDiagnostic

Suppress a diagnostic from a specific block

Description

example

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

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

Examples

collapse all

Using the model from Suppress Diagnostic Messages Programmatically, use the Simulink.suppressDiagnostic function to suppress the parameter precision loss warning thrown by the Constant block, one.

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

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