Systematic Diagnosis of Errors and Warnings
This example shows how to use the Diagnostic Viewer to identify and locate simulation errors and warnings systematically.
Open your model.
If your model contains errors related to callback functions, the Diagnostic Viewer opens and displays the following errors in Model Load stage.
Tip
To open the Diagnostic Viewer window, in the Debug tab, click Diagnostics or click the view errors or warnings link displayed at the bottom of the Simulink® Editor window.
In the Simulink Editor, in the Modeling tab, select Model Settings > Model Properties, and examine the callback error.
After fixing any callback errors, simulate the model to diagnose simulation errors and warnings.
Diagnostic Viewer lists errors and warnings in stages. Each stage in Diagnostic Viewer represents a single event such as model load, update diagram, simulation, or build.
To address errors first, click and to filter out warning and information messages.
To locate the source of the error, click the hyperlink in the message. The model in the source is highlighted. If a block has multiple ports, you can hover over each port to see the port number.
After fixing all errors, simulate your model again and view the Diagnostic Viewer to identify remaining problems.
Note
If an error or warning has a predefined fix, the diagnostic message pane displays a Suggested Actions section. You can use the Fix button provided in this section to rectify the related error or warning. For more information see, Suggested Actions.
If an object in your model generates a warning that you do not want to be notified of, sometimes, you can suppress the warning from the specified source using the Suppress button. You can restore the warning from that source using the Restore button. For example, if a Counter Free-Running block generates an overflow warning that is intentional in your design, you can suppress only overflow warnings from this particular block, without sacrificing notification of other overflows in your model.
To generate code for your model, in the C Code tab, click Build.
Note
If there is a failure during code generation, Diagnostic Viewer provides hyperlinks for easy navigation to the source of the error or warning message.