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

Home » Public Forums » archive » Re: Array question
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: Array question [message #26578] Thu, 13 September 2001 12:45 Go to next message
rkj is currently offline  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 Go to previous message
Craig Markwardt is currently offline  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
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: un-subscribe
Next Topic: Multi-threaded IDL

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

Current Time: Wed Oct 08 19:23:41 PDT 2025

Total time taken to generate the page: 0.00530 seconds