Open topic with navigation

Partitioned Enclose |
(⎕ML<3) |
R←X⊂[K]Y |

Y may be any array. X must be a simple Boolean scalar or vector.

The axis specification is optional. If present, it must be a simple integer scalar or one-element vector. The value of K must be an axis of Y. If absent, the last axis of Y is implied.

X must have the same length as the Kth axis of Y. However, if X is a scalar or one-element vector, it will be extended to the length of the Kth axis of Y.

R is a vector of items selected from Y. The sub-arrays identified along the Kth axis of Y at positions corresponding to each 1 in X up to the position before the next 1 in X (or the last element of X) become the successive items of R. The length of R is +/X (after possible extension).

#### Examples

0 1 0 0 1 1 0 0 0 ⊂⍳9
2 3 4 5 6 7 8 9
1 0 1 ⊂[1] 3 4⍴⍳12
1 2 3 4 9 10 11 12
5 6 7 8
1 0 0 1 ⊂[2]3 4⍴⍳12
1 2 3 4
5 6 7 8
9 10 11 12

Open topic with navigation