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

Home » Public Forums » archive » Re: Arrays in structures; workarounds?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Arrays in structures; workarounds? [message #19962 is a reply to message #19958] Thu, 04 May 2000 00:00 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Ed Santiago <esm@lanl.gov> writes:

>> Does anybody know a way to work around this? [...] The
>> only thing I can come up with is to parse the result of HELP,
>> OUTPUT=out, but that seems like the crappiest solution ever.
>
> Yep. Crappy indeed... but I couldn't find an alternative, either.
>
> Below is a copy of "esmsize", a function I wrote last year when I
> *absolutely needed* to obtain true dimensions within a struct.
>
> Hope it helps,
...

Yes, that's what I was afraid I might have to do. Unfortunately I'd
still like it to work for IDL 4, for which HELP, OUTPUT doesn't work.

Here was one trick I found to determine the size of a structure tag,
if it has *at least* two elements. Try this:

IDL> zz = {x:reform(dblarr(2,2,1),2,2,1)}
IDL> help, zz([0,0]).x
<Expression> DOUBLE = Array[2, 2, 1, 2]

In this case, I index the structure with the [0,0] list while at the
same time extracting the X tag. You get the correct dimensions, with
an extra "2" tacked on the end, which you can then hack off. You need
to handle the case of X being 8 dimensional (!), but it works.
Unfortunately this *doesn't* work if X has only element. Arghh!

A comment on your procedure. I believe that you are treating the
output of HELP too simply. When tag names are long enough, help will
wrap the type description to the next line. Consider this:

IDL> zz = {sdlfkjsdlkfjsdklfjslkfjsldkfjsdlkfjsljfsldkfjsdf:1}
IDL> help, /struct, zz
** Structure <40045788>, 1 tags, length=2, refs=1:
SDLFKJSDLKFJSDKLFJSLKFJSLDKFJSDLKFJSLJFSLDKFJSDF
INT = 1

This will affect both the first tag, and any of the following ones.
Maybe it's better to do a search for the tag you want.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Secrets FFTs revealed!!
Next Topic: Re: DXF output/printer device in IDL?

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

Current Time: Sat Oct 11 09:20:25 PDT 2025

Total time taken to generate the page: 0.80157 seconds