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

Home » Public Forums » archive » Re: print to a variable
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: print to a variable [message #5279 is a reply to message #5278] Mon, 20 November 1995 00:00 Go to previous message
dwu is currently offline  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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Representing graphs in IDL
Next Topic: Read Hex numbers

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

Current Time: Sat Oct 11 15:41:35 PDT 2025

Total time taken to generate the page: 2.39851 seconds