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

Home » Public Forums » archive » STRING(structure) curiosity
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
STRING(structure) curiosity [message #66067] Fri, 10 April 2009 13:30
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
I am using some old code that applies the STRING function to a
structure. This surprised me because I didn't think it was possible.

IDL> a = { v1:bindgen(5), v2:!dpi, v3:['idl','structure'] }
IDL> print,string(a)
% STRING: Struct expression not allowed in this context: A.

The reason it works in the old code is that it used a format statement

IDL> print,string(a,f='( 5i3, f10.6, 2a10) ')
0 1 2 3 4 3.141593 idl structure

So it appears you can apply the STRING function to a structure but you
*must* then supply a format statement. I actually like this
behavior, but I can't find it documented anywhere. Applying STRING
to a structure allows one to efficiently write the structure to an
ASCII file, but I would think that one would always want to specify
the format in such a case. --Wayne
[Message index]
 
Read Message
Previous Topic: ENVI_INIT_TILE tiling problem
Next Topic: Re: STRING(structure) curiosity

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

Current Time: Wed Oct 08 15:37:54 PDT 2025

Total time taken to generate the page: 0.00470 seconds