Following up on
>> How can I assign a matrix to a part of another matrix
A crude solution, used in the context of pasting one image into another.
Note that no error checking is done. "point" is the {row,col} coordinates
of the starting point of the insert.
pasteImage[imagesink_,imagesource_,point_List:{1,1}] :=
Module[{i,rows,cols,irows,icols,row,col},
{irows,icols} = Dimensions[imagesink];
{rows,cols} = Dimensions[imagesource];
{row,col} = point;
Join[
Take[imagesink,row-1],
Table[
Join[Take[imagesink[[i+row-1]],col-1]
,Take[imagesource[[i]],cols]
,Take[imagesink[[i+row-1]],-(icols-cols-col+1)]]
,{i,rows}],
Take[imagesink,-(irows-rows-row+1)]]
]
Andrew B. Watson
MS 262-2 NASA Ames Research Center
Moffett Field CA 94035-1000
(415) 604-5419 -3323 fax
beau at vision.arc.nasa.gov