Re: Again: How to use FORMAT like sprintf?? [message #32225] |
Wed, 25 September 2002 07:24 |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
Brian Huether wrote:
>
> I posted this question and got some great ansers but everytime I tried the
> examples that you all showed me, IDL gave me this error:
>
> Unexpected text in format
>
> I am using IDL 5.2. Could that be the problem? If so, can someone explain
> how to do what I need using version 5.2? Here is my original message:
I don't know when IDL started supporting C style format codes; it might
not have done so yet in 5.2. In that case, you'll need to learn to use
the Fortran-style format codes instead:
IDL> s = string(10, FORMAT= $
IDL> '("IDL has been driving me crazy for the last ",I0," days")' )
IDL> print,s
IDL has been driving me crazy for the last 10 days
IDL> arrayname='A'
IDL> somekeyword='TYPE'
IDL> s = string(arrayname, somekeyword, FORMAT= $
IDL> '("SIZE(",A0,", /",A0,")")' )
IDL> print,s
SIZE(A, /TYPE)
Just look in the online help, or your user's guide, for 'format codes'.
|
|
|
|