Using Simulink | ![]() ![]() |
Creating Custom Simulation Error Messages
The Simulink Diagnostic Viewer displays the output of any instance of the MATLAB error function executed during a simulation, including instances invoked by block or model callbacks or S-functions that you create or that are executed by the MATLAB Function block. Thus, you can use the MATLAB error function in callbacks and S-functions or in the MATLAB Function block to create simulation error messages specific to your application.
For example, in the following model,
the MATLAB Fcn block invokes the following function
Executing this model displays an error message in the Simulation Diagnostic Viewer:
Including Hyperlinks in Error Messages
You can include hyperlinks to blocks, text files, and directories.
Object Links. To include a hyperlink to a block, path, or directory, include the item's path in the error message enclosed in quotation marks, e.g.,
test.data
in the error message. Clicking the link displays the file in your preferred MATLAB editor.
work
directory. Clicking the link opens a system command window (shell) and sets its working directory to c:/wor
k.
Note The text hyperlink is enabled only if the corresponding block exists in the current model or if the corresponding file or directory exists on the user's system. |
![]() | Diagnosing Simulation Errors | Improving Simulation Performance and Accuracy | ![]() |