Navigation

Operators and Keywords

Function List:

C++ API

: C = mat2cell (A, m, n)
: C = mat2cell (A, d1, d2, …)
: C = 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 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.

Package: octave