Hi Jon,
I am a bit confused about what you would like as well, but without boxing you
could do this
(3&{. , 4&{.)"1 arr
0 1 2 0 1 2 3
6 7 8 6 7 8 9
2 3 4 2 3 4 5
8 9 0 8 9 0 1
4 5 6 4 5 6 7
0 1 2 0 1 2 3
6 7 8 6 7 8 9
2 3 4 2 3 4 5
8 9 0 8 9 0 1
4 5 6 4 5 6 7
but I am suspicious of the term 4 elements, so that what you may really want is
this
(3&{."1 ; 4&{.) arr
┌─────┬───────────┐
│0 1 2│0 1 2 3 4 5│
│6 7 8│6 7 8 9 0 1│
│2 3 4│2 3 4 5 6 7│
│8 9 0│8 9 0 1 2 3│
│4 5 6│ │
│0 1 2│ │
│6 7 8│ │
│2 3 4│ │
│8 9 0│ │
│4 5 6│ │
└─────┴───────────┘
Cheers, bob
On Sep 26, 2014, at 9:51 AM, Devon McCormick <[email protected]> wrote:
> Not entirely sure what you want, but is this it?
>
> 3 4{."1&.><arr
> +-----+-------+
> |0 1 2|0 1 2 3|
> |6 7 8|6 7 8 9|
> |2 3 4|2 3 4 5|
> |8 9 0|8 9 0 1|
> |4 5 6|4 5 6 7|
> |0 1 2|0 1 2 3|
> |6 7 8|6 7 8 9|
> |2 3 4|2 3 4 5|
> |8 9 0|8 9 0 1|
> |4 5 6|4 5 6 7|
> +-----+-------+
>
>
> On Fri, Sep 26, 2014 at 12:44 PM, Jon Hough <[email protected]> wrote:
>
>> I have a 2-d array. e.g.
>> arr =: 10 6 $ i. 10
>> I want to get the first 3 columns from the array, e.g. 3{."1and get the
>> first 4 elements, e.g. 4{."1
>> However, combining these, as in
>> 3 4 {."(0 1) arrgives a length error. Of course 3{. and 4{. will give
>> different shape results so should be boxed and then concatenated
>> perhaps(?). I am not sure how to do this, but the end result I want would
>> be something like:
>>
>> ┌─────┐
>>
>> │0 1 2│
>>
>> │6 7 8│
>>
>> │2 3 4│
>>
>> │8 9 0│
>>
>> │4 5 6│
>>
>> │0 1 2│
>>
>> │6 7 8│
>>
>> │2 3 4│
>>
>> │8 9 0│
>>
>> │4 5 6│
>>
>> └─────┘
>>
>>
>> concatenated with
>>
>>
>> ┌───────┐│0 1 2 3││6 7 8 9││2 3 4 5││8 9 0 1││4 5 6 7││0 1 2 3││6 7 8 9││2
>> 3 4 5││8 9 0 1││4 5 6 7│
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> └───────┘
>>
>>
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
>
> --
> Devon McCormick, CFA
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm