Working with packed matrices

extract(M, [n]) Returns the nth color component of packed 3-color matrix M. When only the color image matrix is supplied, all three components are returned in a nested matrix.

replace(M, N, n) Returns packed image matrix M with the nth color component replaced by matrix N, which must have the same number of rows as M and 1/3 as many columns.

Arguments: