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

Home » Public Forums » archive » Force to print exponential to e-6
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: Force to print exponential to e-6 [message #88047 is a reply to message #88045] Fri, 14 March 2014 06:41 Go to previous message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Friday, 14 March 2014 14:19:55 UTC+1, Doppler wrote:
> I have, say an array with three numbers:
>
> [2e-5,2e-6,2e-7]
>
>
>
> I would like to print them on screen like this
>
> 20.0e-6, 2.0e-6, 0.2e-6
>
>
>
> so forcing the exponential to be -6.
>
>
>
> I can't figure it out how to do it. I'm trying to use string(format='(e)', x) without success.
>
>
>
> Thanks

Here is one (ugly and nongeneral) way to do it:

IDL> a = [2e-5,2e-6,2e-7]
IDL> print, a*1e6, format='(3(f0.1, "e-6, "))'
20.0e-6, 2.0e-6, 0.2e-6

--
Yngvar
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Optimizing code for faster calculation
Next Topic: Need help with map projection conversion in IDL or ENVI

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

Current Time: Wed Oct 08 17:51:51 PDT 2025

Total time taken to generate the page: 0.00404 seconds