Function Reference
— Loadable Function: b = mat2cell (a, m, n)
— Loadable Function: b = mat2cell (a, d1, d2, ...)
— Loadable Function: b = mat2cell (a, r)

Convert the matrix a to a cell array. If a is 2-D, then it is required that sum (m) == size (a, 1) and sum (n) == size (a, 2). Similarly, if a is a multi-dimensional and the number of dimensional arguments is equal to the dimensions of a, then it is required that sum (di) == size (a, i).

Given a single dimensional argument r, the other dimensional arguments are assumed to equal size (a,i).

An example of the use of mat2cell is

          mat2cell (reshape(1:16,4,4),[3,1],[3,1])
           {
           [1,1] =
          
              1   5   9
              2   6  10
              3   7  11
          
           [2,1] =
          
              4   8  12
          
           [1,2] =
          
             13
             14
             15
          
           [2,2] = 16
          }

See also: num2cell cell2mat