Re: Array question [message #26578] |
Thu, 13 September 2001 12:45  |
rkj
Messages: 66 Registered: February 1996
|
Member |
|
|
R. Kyle Justice (rkj@dukebar.crml.uab.edu) wrote:
: I have a 3D array that I need to reformat to a 2D
: array, but I don't think I can use REBIN because
: the third dimension needs to be grouped with the
: first.
: arr(60,80,100) needs to be arr(6000,80)
: Any ideas without loops?
: KJ
Pose the question to the group and then the answer
will come to you.
Transpose(arr)
Reform(arr) not Rebin
Kyle
|
|
|
Re: Array question [message #26721 is a reply to message #26578] |
Thu, 13 September 2001 14:30  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
rkj@dukebar.crml.uab.edu (R. Kyle Justice) writes:
> R. Kyle Justice (rkj@dukebar.crml.uab.edu) wrote:
> : I have a 3D array that I need to reformat to a 2D
> : array, but I don't think I can use REBIN because
> : the third dimension needs to be grouped with the
> : first.
>
> : arr(60,80,100) needs to be arr(6000,80)
>
> : Any ideas without loops?
>
> : KJ
>
> Pose the question to the group and then the answer
> will come to you.
>
> Transpose(arr)
> Reform(arr) not Rebin
Excellent! Though, you might be careful about which way you transpose
a 3d array since there are so many permutations. For example, both
these uses of TRANSPOSE will group the 1st and 3rd dimensions:
IDL> a = indgen(2,3,4)
IDL> help, transpose(a,[0,2,1])
<Expression> INT = Array[2, 4, 3]
IDL> help, transpose(a,[1,0,2])
<Expression> INT = Array[3, 2, 4]
The question is whether you want to keep the original 1st dimension in
the same position or in the 2nd position.
Good luck,
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|