NAG Toolbox: nag_issue_warnings
Purpose
nag_issue_warnings determines how errors from NAG Toolbox functions are signalled.
Syntax
warnp = nag_issue_warnings
warnp = nag_issue_warnings(setwarn)
Description
nag_issue_warnings determines whether errors in NAG Toolbox routines are
signalled by errors of the style NAG:error_sv (where s is p to indicate a positive value and n to indicate a negative
value, and n is an integer) or
via the return value of an error flag (ifail or info). Using
NAG:error_sv is the default behaviour.
warnp = nag_issue_warnings returns the current setting (true or false).
warnp = nag_issue_warnings(setwarn) where setwarn is a logical scalar sets the current
behaviour to either true or false.
Tips
Note that this allows for two styles of programming. Errors can be
caught using a try/catch block while the return values of an error
flag can be interrogated. Note that some routines will issue warnings
even if nag_issue_warnings is set to false if the return values of some
of the output parameters are useful.
References
None.
Parameters
Input Parameter
- 1:
setwarn – logical scalar
-
If this parameter is used, then the
error behaviour is set to use warnings and report errors
via ifail or inform parameter (true), or set to
raise MATLAB exceptions (false).
Output Parameter
- 1:
warnp – logical scalar
-
Reports the current error behaviour.
Error Indicators and Warnings
None.
Example
[result, abserr, ~, ~, ifail] = d01aj(@(x)1/x,0,1,1e-5,1e-5)
??? Error using ==> d01aj
d01aj returned an error indicator (1)
nag_issue_warnings(true)
ans =
1
[result, abserr, ~, ~, ifail] = d01aj(@(x)1/x,0,1,1e-5,1e-5)
Warning: d01aj returned a warning indicator (1)
result =
145.6489
abserr =
9.3506
ifail =
1
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009