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

Home » Public Forums » archive » printing structure values on one line
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
printing structure values on one line [message #303] Wed, 01 July 1992 07:00 Go to next message
knight is currently offline  knight
Messages: 37
Registered: January 1992
Member
For an application that wants card images (Lowtran), I want to print
the values of a structure
without the {}'s
and
on one line.

Here's an example of the problem.

IDL> t={a:0.,b:0.,c:0.}
IDL> print,t
{ 0.00000 0.00000 0.00000}
IDL> print,t,format='(3f10.2)'
0.00
0.00
0.00

I'd like to print the values on one line, not 3 for example.
Does anybody have any ideas?

Fred
--
=Fred Knight (knight@ll.mit.edu) (617) 981-2027
C-483\\MIT Lincoln Laboratory\\244 Wood Street\\Lexington, MA 02173
Re: printing structure values on one line [message #304 is a reply to message #303] Wed, 01 July 1992 07:55 Go to previous messageGo to next message
knight is currently offline  knight
Messages: 37
Registered: January 1992
Member
In article <1992Jul1.142422.21291@ll.mit.edu>, knight@ll.mit.edu (Fred Knight) writes:
|>
|> In article <1992Jul1.140033.20864@ll.mit.edu>, knight@ll.mit.edu (Fred Knight) writes:
|> |>
|> |> For an application that wants card images (Lowtran), I want to print
|> |> the values of a structure
|> |> without the {}'s
|> |> and
|> |> on one line.
|> |>
|> |> Here's an example of the problem.
|> |>
|> |> IDL> t={a:0.,b:0.,c:0.}
|> |> IDL> print,t
|> |> { 0.00000 0.00000 0.00000}
|> |> IDL> print,t,format='(3f10.2)'
|> |> 0.00
|> |> 0.00
|> |> 0.00
|> |>
|> Here's one solution:
|> IDL> print,string(t,format='(3f10.2)')
|> 0.00 0.00 0.00
|>
|> However, I still think the print should give the same result.
|>
But there's a bug in string! Count the characters in the second and third
fields: there are 11 not 10! The first field is correct but the rest have
one extra blank.

Fred
--
=Fred Knight (knight@ll.mit.edu) (617) 981-2027
C-483\\MIT Lincoln Laboratory\\244 Wood Street\\Lexington, MA 02173
Re: printing structure values on one line [message #305 is a reply to message #303] Wed, 01 July 1992 11:26 Go to previous messageGo to next message
dit is currently offline  dit
Messages: 5
Registered: July 1992
Junior Member
In article <1992Jul1.140033.20864@ll.mit.edu>, knight@ll.mit.edu (Fred Knight) writes:
>
> For an application that wants card images (Lowtran), I want to print
> the values of a structure
> without the {}'s
> and
> on one line.
>
> Here's an example of the problem.
>
> IDL> t={a:0.,b:0.,c:0.}
> IDL> print,t
> { 0.00000 0.00000 0.00000}
> IDL> print,t,format='(3f10.2)'
> 0.00
> 0.00
> 0.00
>
> I'd like to print the values on one line, not 3 for example.
> Does anybody have any ideas?

Yes, try this:

IDL> print, t, format='($, f10.2)'

The $ will suppress the newline implied by the closing parenthesis.
Hope this helps.

Karl-Heinz
____________________________________________________________ ___
Dipl.-Ing. Karl-Heinz Dittberner | Address: Arnimallee 22
Dept. Scientific Data Processing | D-1000 Berlin 33
c/o Free University of Berlin | Phone: (+4930) 838 2531
E-Mail: dit@vaxser.grumed.fu-berlin.de (Internet)
Re: printing structure values on one line [message #496 is a reply to message #303] Wed, 01 July 1992 20:24 Go to previous message
jdlb is currently offline  jdlb
Messages: 11
Registered: July 1992
Junior Member
knight@ll.mit.edu (Fred Knight) writes:
|>
|> For an application that wants card images (Lowtran), I want to print
|> the values of a structure
|> without the {}'s
|> and
|> on one line.


You can
IDL> print, t, format='(3f10.2,$)' & print ;$ means no carriage return.
Or simply
IDL> print, t.a, t.b, t.c

If you don't know the number of tags, use N_TAGS(t) to find it and use the
STRING procedure in an iterative loop:
IDL> text = ''
IDL> for i=0,n_tags(t)-1 do text = text+string(t.(i))
IDL> print,text
0.00000 0.00000 0.00000


--Jeff
Re: printing structure values on one line [message #501 is a reply to message #303] Wed, 01 July 1992 07:24 Go to previous message
knight is currently offline  knight
Messages: 37
Registered: January 1992
Member
In article <1992Jul1.140033.20864@ll.mit.edu>, knight@ll.mit.edu (Fred Knight) writes:
|>
|> For an application that wants card images (Lowtran), I want to print
|> the values of a structure
|> without the {}'s
|> and
|> on one line.
|>
|> Here's an example of the problem.
|>
|> IDL> t={a:0.,b:0.,c:0.}
|> IDL> print,t
|> { 0.00000 0.00000 0.00000}
|> IDL> print,t,format='(3f10.2)'
|> 0.00
|> 0.00
|> 0.00
|>
Here's one solution:
IDL> print,string(t,format='(3f10.2)')
0.00 0.00 0.00

However, I still think the print should give the same result.

Fred
--
=Fred Knight (knight@ll.mit.edu) (617) 981-2027
C-483\\MIT Lincoln Laboratory\\244 Wood Street\\Lexington, MA 02173
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: CALL_EXTERNAL: accessing global variables from IDL
Next Topic: char orientation

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

Current Time: Wed Oct 08 09:20:45 PDT 2025

Total time taken to generate the page: 0.00686 seconds