MATLAB Function Reference Previous page   Next Page
lastwarn

Return last warning message

Syntax

Description

msgstr = lastwarn returns the last warning message generated by MATLAB.

[msgstr, msgid] = lastwarn returns the last warning in msgstr and its message identifier in msgid. If the warning was not defined with an identifier, lastwarn returns an empty string for msgid. See Message Identifiers and Warning Control in the MATLAB documentation for more information on the msgid argument and how to use it.

lastwarn('new_msgstr') sets the last warning message to a new string, new_msgstr, so that subsequent invocations of lastwarn return the new warning message string. You can also set the last warning to an empty string with lastwarn('').

lastwarn('new_msgstr', 'new_msgid') sets the last warning message and its identifier to new strings new_msgstr and new_msgid, respectively. Subsequent invocations of lastwarn return the new warning message and message identifier.

[msgstr, msgid] = lastwarn('new_msgstr', 'new_msgid') returns the last warning message and its identifier, also changing these values so that subsequent invocations of lastwarn return the message and identifier strings specified by new_msgstr and new_msgid, respectively.

Remarks

lastwarn does not return warnings that are reported during the parsing of MATLAB commands. (Warning messages that include the failing file name and line number are parse-time warnings.)

Examples

Specify a message identifier and warning message string with warning:

Use lastwarn to determine the message identifier and error message string for the operation:

See Also

warning, error, lasterr, lasterror


Previous page  lasterror lcm Next page

© 1994-2005 The MathWorks, Inc.