Re: print to a variable [message #5261] |
Fri, 24 November 1995 00:00 |
Frank J. �ynes
Messages: 17 Registered: February 1995
|
Junior Member |
|
|
dwu@larry.cc.emory.edu (Ding Wu) wrote:
> C R Shaw (C.Shaw@qub.ac.uk) wrote:
>
> : Have you tried the JOURNAL command??
> : --
>
> JOURNAL can record all the commands and the print results,
> but cannot save everything on the screen, such as help
> results.
>
> Thank you anyway.
> --
> Ding Wu
If I understand you correctly, you want to log everything, i.e. both
stderr and stdout, to a file during your idl session.
If you start idl via an xterm, the simplest is probably to enable
logging. Something like
xterm -l -lf logfile -e idl &
will start idl in an xterm, and everything will be logged to the file
logfile.
This is for "my" xterm. The flags -l and -lf may not be the same
on your xterm.
To run it in your current window, you could redirect stderr to stdin
and then use tee to log to a file:
idl 2>&1 | tee logfile
(this is valid for sh, bash, ....)
But beware, I'm not sure if the terminal window output will
keep its nice default formatting. You need to try it yourself.
--
/* Frank J. �ynes | frank@spacetec.no /*
/* Spacetec a.s | Phone: +47 77684500 Fax: +47 77655859 /*
/* Prestvannv. 38, | /*
/* N-9005 Troms�, Norway | (...with the bravery of being out of range!) /*
|
|
|
Re: print to a variable [message #5266 is a reply to message #5261] |
Wed, 22 November 1995 00:00  |
dwu
Messages: 14 Registered: November 1995
|
Junior Member |
|
|
C R Shaw (C.Shaw@qub.ac.uk) wrote:
: Have you tried the JOURNAL command??
: --
JOURNAL can record all the commands and the print results,
but cannot save everything on the screen, such as help
results.
Thank you anyway.
--
Ding Wu
|
|
|
Re: print to a variable [message #5267 is a reply to message #5266] |
Wed, 22 November 1995 00:00  |
C.Shaw
Messages: 1 Registered: November 1995
|
Junior Member |
|
|
In article <48qs6j$32f@curly.cc.emory.edu>,
dwu@curly.cc.emory.edu (Ding Wu) writes:
> The question is how to print all the stuff into a string stead of screen.
> such as when you type help, you will see
> IDL> help
> % At $MAIN$
> Code area used: 0% (0/32768), Symbol area used: 0% (4/8192)
> # local variables: 0, # parameters: 0
> Compiled Procedures:
> $MAIN$
> Compiled Functions:
>
> What I want is a string or array of string to store these information.
>
> I have a method:
>
> shell> idl > idl.log
> IDL> (do the job, print, help,...)
> all of these will not be seen on the screen, it will be in the
> file idl.log
> IDL> (test how many lines in the file use NOT EOF(unit) )
> IDL> (replicate a string to an array of string)
> IDL> (readf the file to the string array)
>
> This method will print all the results, and not show them on the screen.
> Now my question is how to print only one command result, and also
> print everything to the screen simultaneously.
>
Have you tried the JOURNAL command??
--
------------------------------------------------------------ -
Mail : Dept. of Pure and Applied Physics,
Queen's University Belfast,
University Road.
Belfast BT7 1NN
E-mail : C.Shaw@QUB.ac.uk
Phone : (01232) 245133 Ext 3045
Fax : (01232) 438918
------------------------------------------------------------ -
|
|
|
Re: print to a variable [message #5278 is a reply to message #5266] |
Mon, 20 November 1995 00:00  |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
gfu@shark.gsfc.nasa.gov (Gary Fu) writes:
> Hi,
> Is there a simple way to write outputs to a string variable that has
> the same result as by using the 'print' statement ?
> I'm asking something like 'sprintf' as to 'printf' in C.
Yes, you can use the STRING function with the /PRINT qualifier. For example,
IDL> print,indgen(10)
0 1 2 3 4 5 6 7 8
9
IDL> s = string(indgen(10),/print)
IDL> help,s
S STRING = Array(2)
IDL> print,s(0)
0 1 2 3 4 5 6 7 8
IDL> print,s(1)
9
Bill Thompson
|
|
|
Re: print to a variable [message #5279 is a reply to message #5278] |
Mon, 20 November 1995 00:00  |
dwu
Messages: 14 Registered: November 1995
|
Junior Member |
|
|
The question is how to print all the stuff into a string stead of screen.
such as when you type help, you will see
IDL> help
% At $MAIN$
Code area used: 0% (0/32768), Symbol area used: 0% (4/8192)
# local variables: 0, # parameters: 0
Compiled Procedures:
$MAIN$
Compiled Functions:
What I want is a string or array of string to store these information.
I have a method:
shell> idl > idl.log
IDL> (do the job, print, help,...)
all of these will not be seen on the screen, it will be in the
file idl.log
IDL> (test how many lines in the file use NOT EOF(unit) )
IDL> (replicate a string to an array of string)
IDL> (readf the file to the string array)
This method will print all the results, and not show them on the screen.
Now my question is how to print only one command result, and also
print everything to the screen simultaneously.
Mark Rivers (rivers@cars3.uchicago.edu) wrote:
: In article <48qip6$i99@post.gsfc.nasa.gov>, gfu@shark.gsfc.nasa.gov (Gary Fu) writes:
: >Is there a simple way to write outputs to a string variable that has
: >the same result as by using the 'print' statement ?
: >
: >I'm asking something like 'sprintf' as to 'printf' in C.
: >
: Use the string() function:
: IDL> a = !pi
: IDL> b = 'This is PI: ' + string(a)
: IDL> print, b
: This is PI: 3.14159
: Note that the string function takes a "format" keyword, just like print:
: IDL> print, string(!pi, format='(f10.2)')
: 3.14
: ____________________________________________________________
: Mark Rivers (312) 702-2279 (office)
: CARS (312) 702-9951 (secretary)
: Univ. of Chicago (312) 702-5454 (FAX)
: 5640 S. Ellis Ave. (708) 922-0499 (home)
: Chicago, IL 60637 rivers@cars3.uchicago.edu (Internet)
--
Ding Wu
|
|
|