Using fwrite and controlling decimal places

Stephen R McMillan smcmillan at PLANALYTICS.COM
Tue Feb 6 12:03:44 EST 2007


Try this Meredith:

tmp=math_format('%0.2f',tmp) where tmp is your temperature variable.

Good luck--
Stephen McMillan




Meredith Croke <mcroke at AIRDAT.COM> 
Sent by: GRADSUSR at LIST.CINECA.IT
02/06/2007 11:35 AM
Please respond to
GRADSUSR at LIST.CINECA.IT


To
GRADSUSR at LIST.CINECA.IT
cc

Subject
Using fwrite and controlling decimal places





Hi  Everyone,
 
I am new to GrADS  and am trying to write a file that has 10 columns of 
temperature readings  for over 600 times.  The problem I am running into 
is controlling how far  the number extends beyond the decimal point.  I 
would like there to only be  two digits.  I tried using 'set dignum 2', 
but this didn't work, and from  what I can tell it is mainly used for 
plotting.
 
My write line is as  follows: f=write (test.dat, 
ds' 'hs' 'df' 'hf' 0'fff' 'TF' 'TF1' 'TF2' 'TF3' 'TF4' 'TF5' 'TF6' 'TF7' 'TF8' 'TF9,append)
 
Where all the TF's  are the temperatures that I would like to only have 2 
numbers after the decimal  point.
 
Is there some format  statement I can put in that would fix this problem?
 
Thanks for your  help!
 
Sincerely,
 
Meredith
 
 



***************************************************
The information contained in this e-mail message is intended only for the use of the recipient(s) named above and may contain information that is privileged, confidential, and/or proprietary.  If you are not the intended recipient, you may not review, copy or distribute this message.  If you have received this communication in error, please notify the sender immediately by e-mail, and delete the original message.
***************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20070206/8b0e55f4/attachment.html 


More information about the gradsusr mailing list