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

Home » Public Forums » archive » Re: Problems with scalar 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
Re: Problems with scalar structures [message #11799] Tue, 26 May 1998 00:00
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Brian Jackel <jackel@danlon.physics.uwo.ca> writes:
>
> Can anyone suggest a (simple, elegant) way to deal with
> the generic command
>
> test.x= test.x * a
>
> where "test.x" and "a" are arrays of length N, and N is
> sometimes equal to 1?

I use the following, and it seems to work fine:

test(*).x = test(*).x * a

It works under both IDL 4 and 5. By the way, I think even "scalar"
structures are actually vectors of length one, so this notation should
always work.

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@astrog.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: Problems with scalar structures [message #11806 is a reply to message #11799] Tue, 26 May 1998 00:00 Go to previous message
Peter Mason is currently offline  Peter Mason
Messages: 145
Registered: June 1996
Senior Member
On Mon, 25 May 1998, Brian Jackel wrote:
> Here's a little problem that I'd appreciate some input
> on. Consider a simple structure, and an array of those
> structures:
>
> test= {MYSTRUC, name:'mystruct', x:0.0}
> test2= REPLICATE({MYSTRUC},2)
>
> Then try the following two operations, and watch the
> second one fail (at least for version 5.0.2 under IRIX).
>
> test2.x= test2.x * [1.0, 2.0]
> test.x= test.x * [1.0]
>
<...>
> Can anyone suggest a (simple, elegant) way to deal with
> the generic command
> test.x= test.x * a

The best way would be to upgrade to IDL 5.1, which copes with this OK (on WinNT
at least).
But perhaps like me you have at least some platforms "stuck on 5.0x" on account
of ENVI! In this case, try:
test.x(0)= test.x * a
This appears to work, because you can zero-subscript just about anything in IDL.


Peter Mason
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Q: DEFROI for object-graphics?
Next Topic: Re: vector overplot

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

Current Time: Wed Oct 08 13:48:09 PDT 2025

Total time taken to generate the page: 0.00585 seconds