warning

Prints the given input string, s, as a warning.

Syntax

warning(s, ...)

warning('on',id)

warning('off',id)

warning('query',id)

Inputs

s
Warning message. This can also be specified as a template string using the same format guidelines as printf.
Type: char
Dimension: string
id
Turn on/off warnings of a specific type. For now the only supported option is 'all'.
When used with 'on', turns on all warning messages.
When used with 'off', turns off all warning messages.
When used with 'query', returns the current state of warning messages.
Type: char
Dimension: string

Examples

Simple warning message:

warning('This is a simple warning message')
Warning: This is a simple warning message in call to function help at line number 1
Formatted warning message:
warning('This is a %s warning message, id [%d]', 'formatted', 24)
Warning: This is a formatted warning message, id [24] in call to function help at line number 1      

Comments

The input, s, can also be specified as a template string, using the same format guidelines as printf. The warning set can be retrieved by using the command, lastwarn.