MathGroup Archive 2008

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

Search the Archive

Re: controlling Print output

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94595] Re: controlling Print output
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 17 Dec 2008 06:32:59 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <gi820v$gcp$1@smc.vnet.net>

salcedo at ugr.es wrote:

> In order to control the working of the jobs I often  want them to
> print from time to time. The problem is that each new printing adds a
> new line each time, filling out many screens.
> Is it possible to remove this feature so that the output is written on
> the same line always (i.e. to prevent the automatic carriage return)?

To avoid the insertion of a carriage return you could use 
*WriteString["stdout", "text_to_be_on_a_same_line"]*.

Also, *PrintTemporary[]*, which automatically discards the generated 
cells when the evaluation is done, might be an option, as well as 
*Monitor[]*.

Here are examples of each of these solutions.

Do[If[Mod[i, 10] == 0, WriteString["stdout", " Step " <> ToString[ i]];
   Pause[.2]], {i, 50}]

  Step 10 Step 20 Step 30 Step 40 Step 50

Do[If[Mod[i, 10] == 0, PrintTemporary["Step " <> ToString[ i]];
   Pause[.2]], {i, 50}]

Monitor[Do[If[Mod[i, 10] == 0, cnt = i; Pause[.2]], {i, 50}], cnt]

Hope this helps,
-- Jean-Marc



  • Prev by Date: Re: Some Problem With 7.0.0
  • Next by Date: Re: Some Problem With 7.0.0
  • Previous by thread: controlling Print output
  • Next by thread: Plot and filling option