Than you Elijah, that second example is exactly what I want!

> On 9 Mar 2022, at 05:59, Elijah Stone <elro...@elronnd.net> wrote:
> 
> Something like this, perhaps?
> 
>   ]a=. i.5 5
> 0  1  2  3  4
> 5  6  7  8  9
> 10 11 12 13 14
> 15 16 17 18 19
> 20 21 22 23 24
>   ]b=. 2 2 $ 100 200 300 400
> 100 200
> 300 400
>   b (<1 2;0 1)} a
>  0   1  2  3  4
> 100 200  7  8  9
> 300 400 12 13 14
> 15  16 17 18 19
> 20  21 22 23 24
> 
> Note this requires you to specify the entire perimeter of b.  Here's a 
> version which abstracts that logic, specifying only the coordinate of the 
> upper-left corner:
> 
>   am=. {{ x (<m <@(+i.)"0 $x)} y }}
>   b 2 2 am a
> 0  1   2   3  4
> 5  6   7   8  9
> 10 11 100 200 14
> 15 16 300 400 19
> 20 21  22  23 24
> 
> This will also work for higher-rank a and b.
> 
> -E
> 
>> On Wed, 9 Mar 2022, Richard Donovan wrote:
>> 
>> Can I amend an array with a smaller array? For example amend a 5x5 array by 
>> a 2x2 array starting at location x,y within the larger array?
>> 
>> Thanks
>> 
>> Richard Donovan
>> ----------------------------------------------------------------------
>> 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