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

Home » Public Forums » archive » Re: Formatting output
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Formatting output [message #23434] Fri, 26 January 2001 16:19 Go to next message
mohamed_nur is currently offline  mohamed_nur
Messages: 3
Registered: October 2000
Junior Member
>> But it comes out with spaces...

If the code gives you the setup you want and have it in string form just
use result=STRCOMPRESS(variable, /REMOVE_ALL), but if thats not the case
ignore.


Mohamed Nur
York Univer.


Sent via Deja.com
http://www.deja.com/
Re: Formatting output [message #23435 is a reply to message #23434] Fri, 26 January 2001 16:10 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Guillaume Dargaud (dargaud@sung3.ifsi.rm.cnr.it) writes:

> 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...

I'm not sure exactly what you are trying to do
here, because you a putting at least one space
in with your format statement. But you could
probably eliminate most of the others by
using I0 as the integer format specifier.
The zero indicates that IDL should use the
"natural" width of the number.

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
Re: Formatting output [message #23437 is a reply to message #23435] Fri, 26 January 2001 15:38 Go to previous messageGo to next message
Richard French is currently offline  Richard French
Messages: 173
Registered: December 2000
Senior Member
Guillaume Dargaud wrote:
>
> 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."


Could you type in a typical input 'float' value and the output
you are trying to get from it? Then I am sure we can help you!
DIck French
Re: Formatting output [message #23597 is a reply to message #23435] Mon, 29 January 2001 11:50 Go to previous message
Guillaume Dargaud is currently offline  Guillaume Dargaud
Messages: 15
Registered: January 2001
Junior Member
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 ?
--
Guillaume Dargaud
Colorado State University - Dept of Atmospheric Science
http://rome.atmos.colostate.edu/
"Relax, its only ONES and ZEROS !"
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Reading GrADS data file in IDL
Next Topic: Re: Creating a sphere (Object Graphics)

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

Current Time: Wed Oct 08 13:55:47 PDT 2025

Total time taken to generate the page: 0.00490 seconds