Brilliant, that's exactly what I was looking for! I forgot to try that.

Thanks,
Jon

--------------------------------------------
On Wed, 1/24/18, Rob Hodgkinson <[email protected]> wrote:

 Subject: Re: [Jprogramming] Reshaping 3+d matrices
 To: [email protected]
 Date: Wednesday, January 24, 2018, 4:32 PM
 
 Hi John, did you try dyadic
 transpose (x |: y) where x is a reposition vector of
 dimensions …
 
    (1 0 2
 |: mat) -: |:"2|:"3|:"2 mat
 1
 
 …/Rob
 
 > On 24 Jan 2018, at 6:21
 pm, 'Jon Hough' via Programming <[email protected]>
 wrote:
 > 
 > I have a
 3d matrix of shape  a b c say. But I want to reshape it to
 have shape b a c, while still keeping data positional
 integrity.
 > So doing (b,a,c) $, myMatrix
 
 > will not work, as it destroys the
 relative positional relations between items.
 > e.g.
 > 
 > mat =: ?  3 10 20 $ 0 NB. shape
 3x10x20
 > 
 > I can
 reshape it using 
 >
 |:"2|:"3|:"2 mat
 > 
 > But this seems ugly, and based on past
 experience there is usually an obvious / simple / elegant /
 in-built way to
 > do it. It seems like
 there is a nicer way to do it.
 > 
 > Any ideas?
 > 
 > Thanks,
 > Jon
 >
 ----------------------------------------------------------------------
 > For information about J forums see http://www.jsoftware.com/forums.htm
 
 ----------------------------------------------------------------------
 For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to