warn_if

Test a condition and warn if true

Syntax

   wcond = warn_if(wcond,msgstr,warnfunc)

Arguments

input

   wcond      condition to test
   msgstr     string specifying warning message
   warnfunc   string specifying which function issued the warning

output

   wcond      condition to test

Description

Tests the condition wcond; if false the warning message msgstr is printed. A string specifying which function issued the warning may be supplied in warnfunc - if not present it defaults to the enclosing function.

This utility is included for consistency with warn_test.

Example

   A = 10;
   if warn_if(A > 9, 'A is > 9 !!');
       return % can't carry on
   end

See also

warn_test