comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: redirecting output
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: redirecting output [message #40163] Fri, 16 July 2004 13:28
cedricl is currently offline  cedricl
Messages: 8
Registered: July 2004
Junior Member
kl_tah@hotmail.com (KL) wrote in message news:<9af2bc14.0407151757.3142ab13@posting.google.com>...
> Hi,
> anyone know how I can redirect output from the idl command line to a file?
>
> eg. if idl understood unix style redirect, this might look something like
>
> IDL> print, structure.name > filename

You can call a function from the Unix prompt with:

somehost% IDL somefunction

I think that you should be able to redirect the output with a >.
Otherwise, use printf "somefunction, someparameters" | IDL >
output.txt (or something like that). If you don't follow the IDL rule
of one function per file, you can write your tasks in a batch file,
and have it run with

printf "@mybatch" | IDL

In the file mybatch, you can compile functions as you wish with .comp.

It's a little complicated, but I've researched alternatives and
haven't found any. BTW, this is also how I automate the queueing of
IDL commands to run in the background as separate IDL processes, using
at.

HTH,

Cedric
Re: redirecting output [message #40168 is a reply to message #40163] Fri, 16 July 2004 08:02 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
kl_tah@hotmail.com (KL) writes:
> Hi,
> anyone know how I can redirect output from the idl command line to a file?
>
> eg. if idl understood unix style redirect, this might look something like
>
> IDL> print, structure.name > filename

Nigel had a good suggestion.

There's also the good ole' open-print-close approach, as in,

openw, unit, filename, /get_lun
print, unit, structure.name
...
free_lun, unit

Or, you could capture the output in a string and then save it later.
I use this all the time with my PRINTLOG routine,

printlog, log=log, structure.name
printlog, log=log, structure.value, format='(G9.2)'
...

and then you can do anything with the LOG array that you want. It's
just an array of strings, containing a transcript of what you printed
to it.

Good luck,
Craig

P.S. PRINTLOG is at:
http://cow.physics.wisc.edu/~craigm/idl/idl.html

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: redirecting output [message #40170 is a reply to message #40168] Fri, 16 July 2004 02:20 Go to previous message
Nigel Wade is currently offline  Nigel Wade
Messages: 286
Registered: March 1998
Senior Member
On Thu, 15 Jul 2004 18:57:38 -0700, KL wrote:

> Hi,
> anyone know how I can redirect output from the idl command line to a file?
>
> eg. if idl understood unix style redirect, this might look something like
>
> IDL> print, structure.name > filename
>
> thanks,

Depending on what you want to do, you might be able to use the JOURNAL
command.

E.g.

journal,'filename' ; opens a journal into filename
journal,structure.name ; writes strucure.name to the journal
journal ; closes the journal

However, journal has side-effects which might not meet your requirements.

--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Broyden's method
Next Topic: change in syntax for version 6?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:17:18 PDT 2025

Total time taken to generate the page: 0.00529 seconds