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 #45667 is a reply to message #45663] Mon, 26 September 2005 05:04 Go to previous messageGo to previous message
Paolo Grigis is currently offline  Paolo Grigis
Messages: 171
Registered: December 2003
Senior Member
kl_tah@hotmail.com wrote:
> Hi David, Craig,
>
> Thanks for the tips.
> However, what I was really wanting to do was to output a long string of
> numbers, each entry with a different format, to a file (which will
> ultimately be used in a tex table).
> So I have, for eg.
>
> line=[strtrim(3.45,2),'&',strtrim(5.678,2),'\\'] ;and lots more
> printf,lun,line
>
> This would probably mean appending a long string for formats to printf.
> If I could get each entry in to a format I want before putting them in
> an array this would really save on a lot of counting. Perhaps there's a
> way to write a program that does something like
>
> a=3.55677
> a=format(a,'(F4.2)')
> print,a
> 3.55
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 14:58:25 PDT 2025

Total time taken to generate the page: 0.15980 seconds