Main Content

sldiagviewer.reportError

Report error messages in Diagnostic Viewer

Description

sldiagviewer.reportError(Message) reports the diagnostic message as an error in the Diagnostic Viewer.

example

output = sldiagviewer.reportError(Message) returns a logical 1 (true) when the diagnostic message reports successfully in the Diagnostic Viewer. Otherwise, an error message is displayed in the command window and no value is returned.

output = sldiagviewer.reportError(__,'Component',ComponentNameValue) specifies the name of the component or product that generates the diagnostic message.

Examples

collapse all

Display error messages on the Diagnostic Viewer using sldiagviewer.reportError.

Load the model vdp.

model = 'vdp';
load_system(model);

Create a stage to display the diagnostic messages.

myStage = sldiagviewer.createStage('Analysis','ModelName','vdp');

Introduce errors inside the try block and catch the resulting errors in the catch block.

try 
 i = p; 
catch error 
end 

Report the error message in the Diagnostic Viewer.

output = sldiagviewer.reportError(error)

The diagnostic window opens for the model vdp and displays the error message in red in the stage Analysis.

Input Arguments

collapse all

Description of error that is displayed in the Diagnostic Viewer, specified as a string, MSLException object, or MException object.

Example: Unrecognized function or variable 'p'.

Name of the component or product that generates the diagnostic message, specified as a character vector or string.

Example: 'Stateflow', 'Simulink', 'Model Advisor'

Data Types: char | string

Version History

Introduced in R2014a