warn_supp

Suppress printing of Matlab warning message

Syntax

   oldstate = warn_supp(warnid)

Arguments

input

   warnid     Matlab warning identifier (default: 'all', for all warnings)

output

   oldstate   previous state of warning corresponding to warnid

Description

Suppresses printing of Matlab warning message corresponding to warning ID warnid; see warning. The default is to suppress all warnings. The routine warn_test can be used to test whether a condition triggering the given warning was actually issued.

The warn_supp ... warn_test routines exist for two reasons: (1) if routines issuing warnings are run in a loop (which they frequently are in the MVGC Toolbox), Matlab will by default spew confusing warnings, obscuring meaningful ouput; (2) we want to be able to issue meaningful context-dependent warning messages.

Example

   A = magic(6);
   oldstate = warn_supp('MATLAB:nearlySingularMatrix');
   B = inv(A);
   warn_test(oldstate,'badly-conditioned matrix?');

See also

warning | warn_test | startup