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

Home » Public Forums » archive » Re: number format in structure
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: number format in structure [message #45662] Mon, 26 September 2005 11:34 Go to previous message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
<kl_tah@hotmail.com> wrote in message
news:1127758210.699607.161150@g47g2000cwa.googlegroups.com.. .
> Hi Paolo,
>
> Thanks for the tip. It works for positive numbers. Do you happen to
> know how to get it to work for negative numbers?
> I get:
>
> IDL> help,a
> A FLOAT = -4.35660
> IDL> print,string(a)
> -4.35660
> IDL> print,string(a,format='(4.2)')
> ****


you need to specify enough "digits" (you also forget an 'f' in your format).

try
print,string(-4.35660,format='(f5.2)')
-4.36

Note that there are 5 characters in the printout, including the negative
sign and the decimal.

Cheers,
bob

PS the **** indicates that the number does not fit into the defined format
statement.
The answer is usually to make the format bigger.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help needed: read procedure for SCAN-data (soil climate analysis network)
Next Topic: undercurve highlight/Shade

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

Current Time: Wed Oct 08 18:55:42 PDT 2025

Total time taken to generate the page: 0.00368 seconds