|SYNTAX||MxCopy( & dstmatrix, dst_start_row, dst_endrow, dst_start_col, dst_end_col, src_matrix, src_start_row = -1, src_end_row = -1, src_start_col = -1, src_end_col = -1 )|
|FUNCTION|| Copy rectangular block from one matrix to the other (copy portions of one matrix to the other matrix)
The function works in-place (ie. no allocation occurs - first argument is a reference to existing array and that array content would be overwritten)
src_start/src_end values equal to -1 mean "same value as corresponding dst_start/dst_end value"
As you noticed shape of source and destination "rectangles" does not need to be the same - for example you can copy vertical column into horizontal row, but the number of elements to be copied must be matching. So, to perform a copy the number of columns multiplied by number of rows in source and destination "rectangles" must be the same. In other words:
(dst_end_row-dst_start_row+1)*(dst_end_col-dst_start_col+1) == (src_end_row-src_start_row+1)*(src_end_col-src_start_col+1)
The MxCopy function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.