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

Home » Public Forums » archive » number format in structure
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
number format in structure [message #45673] Sun, 25 September 2005 18:16 Go to next message
Koh Leong Tah is currently offline  Koh Leong Tah
Messages: 11
Registered: May 2005
Junior Member
Hi All,

does anyone happen to know how I can specify the format to which
numbers stored in structure tags should adhere?

for example, I'd like to (hypothetically) be able to do

s={a:3.2f,b=2.3f}

s.a=123.12345678

will yield

print,s.a
123.12

Any ideas?

Thanks,
KL
Re: Number format [message #72443 is a reply to message #45673] Sat, 11 September 2010 02:45 Go to previous message
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Fri, 10 Sep 2010 20:43:57 -0700 (PDT), mahesh <mkmvarma@gmail.com>
wrote:

> How do I change the format of numbers. For example : from '9.5600' to
> '9.56E+00'. I need to write the numbers in this format into a text
> file. I know there is 'FORMAT' function in IDL. I tried using it right
> after the printf statement. But it is not converting it to the format
> I wanted.
> Thanks,
> Mahesh

IDL> print,9.56,format='(E10.2)'
9.56E+000

This means: scientific notation, 2 digits after the decimal point and
a string length of 10 characters. Make sure this string length is
large enough (depends on the numbers you're printing). On a windows
platform, the exponent has 3 digits, on Linux it has 2. I don't think
you can change that (off course you can manipulate the string itself
before printing it).
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: particle_trace confusion
Next Topic: Re: particle_trace confusion

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

Current Time: Fri Oct 10 23:15:40 PDT 2025

Total time taken to generate the page: 0.40181 seconds