Main Content

sldiagviewer.reportWarning

Report warning messages in Diagnostic Viewer

Description

sldiagviewer.reportWarning(Message) reports the diagnostic message as warning in the Diagnostic Viewer.

example

output = sldiagviewer.reportWarning(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.reportWarning(__,Component=ComponentNameValue) specifies the name of the component or product that generates the diagnostic message.

Examples

collapse all

Display warning messages in the Diagnostic Viewer using sldiagviewer.reportWarning.

Load the model vdp.

model = "DiagnosticDemo";
load_system(model);

Create a stage to display the diagnostic messages.

myStage = sldiagviewer.createStage("Analysis",ModelName=model);

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

try 
 i = p; 
catch error 
end 

Report the warning message in the Diagnostic Viewer.

output = sldiagviewer.reportWarning(error)

The diagnostic window displays the warning message in yellow in the stage Analysis.

Input Arguments

collapse all

Description of warning 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"

Example: "Simulink"

Data Types: string | char

Version History

Introduced in R2014a