MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Check[] *and* Off[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21943] Re: Check[] *and* Off[]
  • From: Eckhard Hennig <hennig at itwm.uni-kl.de>
  • Date: Sat, 5 Feb 2000 00:49:18 -0500 (EST)
  • Organization: ITWM
  • References: <87b0u1$o6v@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Paul Howland schrieb in Nachricht <87b0u1$o6v at smc.vnet.net>...
>Well... before anyone wastes their breath trying to answer my question
>about whether it is possibly to "silently" trap an error message using
>Check[], I have found the way to do it.  And it is trivial.  All you
>need do is temporarily redefine the messages channel.
>
>So, the answer is, do this:
>
>    messagechan=$Messages; $Messages={};
>    Check[myfunction[], myerrfunction[]];
>    $Messages=messagechan;
>
>and the screen no longer fills up with unwanted error messages.  The
>only slight disadvantage of this approach is that *all* error messages
>are lost, so if you are trying to Check[] for specific messages only,
>then you won't see the messages you're not trapping.  I guess in this
>situation you might want to re-direct $Messages to a file instead.

You can also make the untrapped messages visible if you inspect $MessageList
during your computation, remove all messages you don't want to display, and
print everything else to the screen (e.g. using messagechan for output).


Just one further remark regarding the above method for suppressing messages:
When you abort a lengthy calculation performed inside myfunction[], the list
$Messages will remain empty. To switch on message display again, $Messages
must be reset manually to its original value. However, if you use a Block to
override the value of $Messages temporarily, then the message channel will
be restored automatically upon leaving the Block regardless of whether the
computation terminated correctly or was aborted:

   Block[{$Messages = {}}, myfunction[]]


Best regards,

  Eckhard

-----------------------------------------------------------
Dipl.-Ing. Eckhard Hennig      mailto:hennig at itwm.uni-kl.de
Institut fuer Techno- und Wirtschaftsmathematik e.V. (ITWM)
Erwin-Schroedinger-Strasse,  67663 Kaiserslautern,  Germany
  Voice: +49-(0)631-205-3126    Fax: +49-(0)631-205-4139
    http://www.itwm.uni-kl.de/as/employees/hennig.html

     ITWM - Makers of Analog Insydes for Mathematica
        http://www.itwm.uni-kl.de/as/products/ai
-----------------------------------------------------------





  • Prev by Date: Re: NDSolve series of ode with equilibrium conditions
  • Next by Date: Re: Little(?) problem: What is the formula ???
  • Previous by thread: Re: Check[] *and* Off[]
  • Next by thread: Interpolation vs. SplineFit