Main Content

sldiagviewer.reportError

Report error messages in Diagnostic Viewer

Description

example

output = sldiagviewer.reportError(Message) reports the message as an error.

myStage = sldiagviewer.reportError(__,'Component', Value) specifies the name of the component. For example, Stateflow or Model Advisor.

Examples

collapse all

Create a stage and use the reportError function to report an error message in the Diagnostic Viewer for the specified model.

>> vdp >> 

% Create a stage 
my_stage = sldiagviewer.createStage('StageName', 'ModelName', 'vdp'); 
%% write some code inside try, which will throw an error 
try 
 i = p; 
catch error 
end 
sldiagviewer.reportError(error);

output =
     1ogical
      1

The diagnostic window opens up for the model vdp. It shows the StageName and the error message in red.

Input Arguments

collapse all

This message is displayed as an error in the Diagnostic Viewer.

Example: 'This is a custom error message.'

The name of the component specified as the comma-separated pair consisting of 'Component' and a character vector or string.

Example: Stateflow

Output Arguments

collapse all

Shows whether the message was displayed successfully.

Introduced in R2014a