Problems with scalar structures [message #11808] |
Mon, 25 May 1998 00:00 |
Brian Jackel
Messages: 34 Registered: January 1998
|
Member |
|
|
Greetings
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]
The problem is that "test.x" is a scalar, but multiplied
by [1.0] it becomes a FLTARR[1]. Trying to put this back
into "test.x" then gives an error. This is one place where
IDL doesn't treat a FLTARR[1] the same way as a scalar.
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?
Brian
|
|
|