Apologies if this is an ignorant question.  (Always learning)

I want to take “slices” of a multidimensional array.
For simplicity suppose the array is 2 dimensional
(This is not my actual situation but illustrates my difficulties)

m=. i.2 2 

The two horizontal slices are 0{m and 1{m or more simply 0 1{m

The two vertical slices are 0{“1 m and 1{“1 m

But 0 1{“1 m yields m rather than (0{"1 m),:1{"1 m as I want.

I know this can be achieved with say 0 1{|:m 

But (given my more intricate situation) how to do this using rank?

In general, given an n dimensional array how to get the successive slices of 
the array along the successive dimensions as  successive items of the resulting 
array using the rank adverb?


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to