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 #45663 is a reply to message #45662] Mon, 26 September 2005 11:10 Go to previous messageGo to previous message
Koh Leong Tah is currently offline  Koh Leong Tah
Messages: 11
Registered: May 2005
Junior Member
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)')
****

Thanks,
KL

> The command "string" does that for you
> a=3.55677
> b=string(a,format='(F4.2)')
> print,b
>
> 3.56 (rounded, not truncated)
>
> Now you can loop over your values, appending
> the new values and the separators you need using the
> + operator for strings (e.g. output=output+b+'&' )
>
> Cheers,
> Paolo
>>
>>
>> ?
>>
>> Thanks,
>> KL
>>
[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: Fri Oct 10 15:06:46 PDT 2025

Total time taken to generate the page: 7.99980 seconds