Formatting output [message #23439] |
Fri, 26 January 2001 15:15  |
Guillaume Dargaud
Messages: 15 Registered: January 2001
|
Junior Member |
|
|
I want to format a string output but can't get it straight. Basically I want
floats to converts to a string with no space, no decimals and no dots.
I've tried many ways, here's the latest:
FOR i = 0, OrbNum-1 DO xtn[i]=STRING( $
fix(OrbArray[i,0]),fix(OrbArray[i,5]),$
fix(OrbArray[i,6]), FORMAT='(I," ",I,"h",I)')
But it comes out with spaces...
--
Guillaume Dargaud
Colorado State University - Dept of Atmospheric Science
http://rome.atmos.colostate.edu/
"A logician trying to explain logic to a programmer is like a cat trying
to explain to a fish what it's like to get wet."
|
|
|
Re: Formatting output [message #23591 is a reply to message #23439] |
Mon, 29 January 2001 13:59  |
Guillaume Dargaud
Messages: 15 Registered: January 2001
|
Junior Member |
|
|
> If you are using this string for something like
> an axis or plot title, you might try "!C" in
> place of your "/".
Exactly ! Thanks.
--
Guillaume Dargaud
Colorado State University - Dept of Atmospheric Science
http://rome.atmos.colostate.edu/
"Nature, and Nature's laws lay hid in night:
God said: 'Let Newton be !' and all was light." � Alexander Pope
(1688-1744), British poet.
"It did not last: the Devil howling 'Ho !
Let Einstein be !' restored the status quo." � John Collings Squire
(1884-1958), British journalist.
|
|
|
Re: Formatting output [message #23596 is a reply to message #23439] |
Mon, 29 January 2001 12:07  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Guillaume Dargaud (dargaud@sung3.ifsi.rm.cnr.it) writes:
> OK, thanks to your replies, I managed to do what I wanted:
> FOR i=0, OrbNum DO xtn[i]=STRING( $
> OrbArra[i,0], OrbArra[i,12], OrbArray[i,13], $
> FORMAT='(I0, "-", I0, "h", I2.2)' )
>
> Which outputs something like "1234-14h30"
>
> Now I'd like to have this result on 2 lines (instead of a '-' separator).
> So I tried FORMAT='(I0, /, I0, "h", I2.2)'
> But I get "Out of range subscript encountered: XTN"
>
> Any idea ?
If you are using this string for something like
an axis or plot title, you might try "!C" in
place of your "/".
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
|
|
|