Rearrange matrix columns into blocks


A = col2im(B,[m n],[mm nn],'distinct')
A = col2im(B,[m n],[mm nn],'sliding')


A = col2im(B,[m n],[mm nn],'distinct') rearranges each column of B into a distinct m-by-n block to create the matrix A of size mm-by-nn. If B = [A11(:) A21(:) A12(:) A22(:)], where each column has length m*n, then A = [A11 A12; A21 A22] where each Aij is m-by-n.

A = col2im(B,[m n],[mm nn],'sliding') rearranges the row vector B into a matrix of size (mm-m+1)-by-(nn-n+1). B must be a vector of size 1-by-(mm-m+1)*(nn-n+1). B is usually the result of processing the output of im2col(...,'sliding') using a column compression function (such as sum).

col2im(B,[m n],[mm nn]) is the same as col2im(B, [m n], [mm nn],'sliding').

Class Support

B can be logical or numeric. The return value A is of the same class as B.


B = reshape(uint8(1:25),[5 5])'
C = im2col(B,[1 5])
A = col2im(C,[1 5],[5 5],'distinct')

Introduced before R2006a

Was this topic helpful?