Re: Array assignment problems [message #13635] |
Sat, 21 November 1998 00:00 |
steinhh
Messages: 260 Registered: June 1994
|
Senior Member |
|
|
In article <7355qm$nqo$1@nnrp1.dejanews.com> seanr@possys.com writes:
> IDL> displayImage[i,0,0] = BytScl(reform(image[i,*,*]), Max=maxThresh,
[..]
> IDL> displayImage[0,0,i] = BytScl(reform(image[*,*,i]), Max=maxThresh,
Min=minThresh)
> why does the first (displayimage[i,0,0]) not work, but the second does?
Remove the reform() statement in the first one, and it works.
Apparently, IDL tries to match up existing dimensions starting from
the leftmost. So, the fact that you've lost the *last* dimension
(as in the last example) doesn't matter, but it does matter if you
loose the first one, since the one moving up is way too big!
> If I enter it as displayimage[i,*,*] =... then it works, but this is a much
> slower assignment.
This syntax matches up elements by their one-dimensional index. I.e.,
displayimage[i,*,*] (on the left hand side) uniquely identifies (and
indeed generates!) a series (vector) of one-dimensional indices, which
are used to store each of the (ordered) element on the right hand
side, regardless of their dimensional organization (i.e., it could be
a 7-dimensional array with the same numer of elements). The giveaway
is that this works:
IDL> displayimage[i,*,*]=(image(i,*,*))(*)
Regards,
Stein Vidar
|
|
|