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

Home » Public Forums » archive » Re: Reversing a multi-dimensional array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Reversing a multi-dimensional array [message #35591] Mon, 07 July 2003 09:30 Go to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
Hi Andy,

"Andy Loughe ( remove OMITs )" <Andrew.LougheOMIT@noaaOMIT.govOMIT>
wrote in message news:3F04BF29.7030406@noaaOMIT.govOMIT...
> Hello,
>
> I have a 4-dimensional array, but it could someday grow to become
> 6 or 7 dimensions. What I would like to do is reverse the entire
> array, so that if it is now: a(i,j,k,l) it becomes a(l,k,j,i).
>
> What is the most efficient method for accomplishing this in IDL?

While I wouldn't call this a reversal of the array (rather, a
transposition reversing the dimensions of the array), I think what
you're looking for is:

a = Transpose(a)

The reversal of dimensions is the default behaviour of Transpose,
equivalent to:

a = Transpose(a, [3, 2, 1, 0])

If you needed some other ordering, you would give a different ordering
of values in the array.

Cheers,
--
-Dick

Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Variable y-axis sizes in multiplot/ladder?
Next Topic: Slider Question

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

Current Time: Sat Oct 11 00:49:50 PDT 2025

Total time taken to generate the page: 0.01583 seconds