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

Home » Public Forums » archive » SUMMARY: formatted printing of structures
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
SUMMARY: formatted printing of structures [message #464] Tue, 28 July 1992 13:33
knight is currently offline  knight
Messages: 37
Registered: January 1992
Member
In an earlier posting (~10 Jul) I considered the inconsistent results of
printing elements of a structure. This posting summarizes the results,
including a reply from RSI.

The problem is exemplified by the following:

IDL> t={a:0,b:1,c:2}
IDL> print,format='(3f10.2)',t ; BAD---NOT ON ONE LINE
0.00
1.00
2.00
IDL> print,string(format='(3f10.2)',t) ; BAD---f11.2 FOR 2ND AND 3RD TAGS
0.00 1.00 2.00
IDL> print,format='(3f10.2,$)',t & print ; OK---WHAT I WANTED
0.00 1.00 2.00

In brief, this behavior will be corrected in the next version (> 2.3.2) so
that all three statements produce the same results. The explanation from
RSI is the following.

> When printing a variables, IDL decomposes each structure into its
> non-structure components, and then prints all of the components
> according to the format statement or the default formatting.

> There was a problem with the way IDL decomposed the structure into
> its components. Instead of treating all the components as part
> of the same variable, it treated them as separate variables. This
> caused the first example shown above to produce three separate lines
> rather than a single line.

> The IDL routine STRING also uses the same method to deal with variables,
> so the same problem caused STRING to create a string array of three
> elements rather than one string. When the elements of the string array
> are printed they are padded with a single space which explains the output
> from the second example above. This can be seen clearly by using the
> following IDL statement:
> help, string(format='(3f10.2)',t)

> The problem with the decomposition of structure variables has been fixed,
> and will be available in the next version of IDL after IDL V 2.3.2.

Thanks to the people who contributed the solution of using the $ format.

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: Re: Colors with XOR plotting: How to do it
Next Topic: VMS PVwave 3.10 - ASSOC variables and FORTRAN

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

Current Time: Wed Oct 08 11:33:10 PDT 2025

Total time taken to generate the page: 0.00616 seconds