Diagnostics
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 Diagnostic Viewer.
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
Classes
Simulink.SuppressedDiagnostic | Suppress diagnostic messages from specific block |
sldiagviewer.DiagnosticReceiver | Create receiver to get diagnostic details of model operation (Since R2025a) |
Namespaces
sldiagviewer | Summary of classes, functions, and namespaces associated with diagnostics |
sldiagviewer.Comparator | Summary of functions for comparing diagnostics (Since R2025a) |
Apps
Parameter Quantization Advisor | Inspect numerical issues related to parameter quantization (Since R2022b) |
Tools
Diagnostic Viewer | View, compare, and diagnose errors and warnings generated by Simulink models |
Model Settings
Checks
Topics
Diagnostic Viewer
- Systematic Diagnosis of Errors and Warnings
Identify and locate errors and warnings systematically. - Report Diagnostic Messages Programmatically
Usesldiagviewer
functions to generate, display, and log diagnostic messages. - Suppress Diagnostic Messages Programmatically
Suppress and restore diagnostic messages programmatically. - Customize Diagnostic Messages
Customize error messages to display text and hyperlink. - Compare Diagnostic Messages Between Model Simulations
Compare diagnostic messages from different run-time operations of a model in the Diagnostic Viewer. - Compare Diagnostic Messages Between Model Simulations Programmatically
Compare diagnostic messages from different run-time operations of a model programmatically. - Error Handling in Simulink Using MSLException Objects
Simulink allows you to report an error by throwing an exception using theMSLException
object, which is based on the MATLABMException
object.