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

Home » Public Forums » archive » print to a variable
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
print to a variable [message #5282] Mon, 20 November 1995 00:00
gfu is currently offline  gfu
Messages: 10
Registered: October 1995
Junior Member
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.

Thanks.

Gary
Re: print to a variable [message #5284 is a reply to message #5282] Mon, 20 November 1995 00:00 Go to previous message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
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)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Help: changing thickness of contour labels
Next Topic: Join/merge procedure anyone?

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

Current Time: Wed Oct 08 15:38:01 PDT 2025

Total time taken to generate the page: 0.00526 seconds