[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FROM 5.12345 TO 5.12



Mark Chan (chanm@cadvision.com) writes:

> x=[5.12345, 45.378, 1300.3221, ...]
> 
> xyouts, 5,7, x[0]
> 
> Will give: 5.12345 (in some window)
> 
> Want: 5.12
> 
> xyouts, 5,7,format='(f4.2)',x[0]  ---- not allowed, although the following
> is allowed but not what I need
> 
> print,format='(f4.2)',x[0] ---- not what I need
> 
> 
> Any suggestion?

How about this:

   xyouts, 5,7,String(x[0],format='(f4.2)')

:-)

Cheers,

David

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155