Function Reference
— Function File: A = col2im (B, [m,n], [mm,nn], block_type)
— Function File: A = col2im (B, [m,n], [mm,nn])

Rearranges matrix columns into blocks.

A=col2im(B,[m,n],[mm,nn],block_type) rearranges columns of matrix B intro blocks in a way controlled by block_type param, which can take the following values:

distinct
It uses m-by-n distinct blocks (which are not overlapped), and are rearranged to form a mm-by-nn matrix A. B's height must be m*n and col2im rearranges each column to a m-by-n block and uses them to fill the whole matrix in left-to-right and then up-to-down order.
sliding
Is uses m-by-n sliding blocks. It rearranges row vector B to a (mm-m+1)-by-(nn-n+1) matrix A. B must be a 1-by-(mm-m+1)*(nn-n+1).

A=col2im(B,[m,n],[mm,nn]) takes distinct as a default value for block_type.

See also: im2col

Demonstration 1

The following code

 A=[1:10;11:20;21:30;31:40]
 B=im2col(A,[2,5],'distinct')
 C=col2im(B,[2,5],[4,10],'distinct')
 # Divide A using distinct blocks and reverse operation

Produces the following output

A =

    1    2    3    4    5    6    7    8    9   10
   11   12   13   14   15   16   17   18   19   20
   21   22   23   24   25   26   27   28   29   30
   31   32   33   34   35   36   37   38   39   40

B =

    1    6   21   26
   11   16   31   36
    2    7   22   27
   12   17   32   37
    3    8   23   28
   13   18   33   38
    4    9   24   29
   14   19   34   39
    5   10   25   30
   15   20   35   40

C =

    1    2    3    4    5    6    7    8    9   10
   11   12   13   14   15   16   17   18   19   20
   21   22   23   24   25   26   27   28   29   30
   31   32   33   34   35   36   37   38   39   40