Main Content

Diagnostics

View diagnostics for models, configure and customize diagnostic checks, understand diagnostic viewer layout

Simulink® provides diagnostic messages when certain conditions are detected during a Simulink operation on a model. The diagnostic messages are captured under error, information, or warning categories.

The diagnostic messages you encounter in programmatic operations are displayed in the MATLAB® Command Window, while those you encounter during a Simulink user interface operation are displayed in the Diagnostic Viewer. For example, if you simulate a model from the MATLAB command prompt using the sim function, the diagnostics messages are displayed in the Command Window. However, if you run a simulation from the Simulink Toolstrip, the diagnostic messages are displayed in the Diagnostic Viewer.

You can customize the diagnostic messages, and also customize the conditions the software checks to either produce errors or warnings.

The diagnostics for model are displayed in the Diagnostic Viewer user interface. To know more about the diagnostic viewer, see the topic View Diagnostics.

You can also add Model Verification blocks to your model, to check the condition of specific signals. For more information about Model Verification, see topics listed under Run Model Advisor Checks.

Functions

sldiagnosticsDisplay diagnostic information of Simulink system
Simulink.restoreDiagnosticRestore diagnostic warnings to a specific block, subsystem, or model
Simulink.suppressDiagnosticSuppress a diagnostic from a specific block
Simulink.getSuppressedDiagnostics Return Simulink.SuppressedDiagnostic objects associated with a block, subsystem, or model
Simulink.BlockDiagram.getChecksumReturn model checksum
Simulink.SubSystem.getChecksumReturn checksum of nonvirtual subsystem
modeladvisorOpen Model Advisor
sldebugStart simulation debugging session for Simulink model
addtermsAdd terminators to unconnected ports in model
sldiagviewer.createStageCreate stage to display diagnostic messages
sldiagviewer.reportErrorReport error messages in Diagnostic Viewer
sldiagviewer.reportInfoReport information messages in Diagnostic Viewer
sldiagviewer.reportWarningReport warning messages in Diagnostic Viewer
sldiagviewer.diaryLog diagnostic messages and build information in file
sldiagviewer.reportSimulationMetadataDiagnosticsDisplay errors and warnings in Simulink.SimulationOutput object using Diagnostic Viewer (Since R2020b)

Classes

Simulink.SuppressedDiagnosticSuppress diagnostic messages from a specified block
sldiagviewerGenerate, display, and log diagnostic messages in the Diagnostic Viewer

Topics

Diagnostic Viewer

Related Information