Re: IDL number output format problem? [message #53856] |
Fri, 04 May 2007 13:11 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
lixiaoyao writes:
> I know it is a stupid question, but I just can not figure it out.
> Does anyone happen to know how to format one or a few of output
> numbers? Like I want one number has two number after the point, like
> 9.45 istead of 9.453678.
> Thanks in advance
> for i=0,n do printf, lun, F[i,0],F[i,1],(F[i,2],Format='(f9.2)'),F[i,
> 3],F[i,4],F[i,5],F[i,6],F[i,7],F[i,8],F[i,9],F[i,11],F[i,12]
It is probably not as stupid a question as you think it
is. In fact, for some numbers, it is quite difficult to
get formats like you want. You might have a look at the
NUMBER_FORMATTER program, described in this article:
http://www.dfanning.com/misc_tips/dbl_to_str.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|