Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

warning

Print a warning message

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

warning(message)

Description

warning(message) prints the message with the prefix "Warning:".

warning may be used to print information about potential problems in an algorithm. E.g., it is used in limit to provide hints.

Examples

Example 1

A warning:

warning("You should not do this!"):
Warning: You should not do this!

Example 2

This example shows a simple procedure which divides two numbers. If the second argument is omitted, a warning is printed and the computation continues:

mydivide := proc(x, y)
begin
  if args(0) < 2 then
    warning("Denominator not given, using 1.");
    y := 1;
  end_if:
  x/y
end_proc:
mydivide(10)
Warning: Denominator not given, using 1. [mydivide]

Parameters

message

A character string

Return Values

Void object of type DOM_NULL.

See Also

MuPAD Functions

Was this topic helpful?