Skip to content

cell2mat

Convert a cell array to a matrix.

m = cell2mat(c)

Concatenates the contents of cell array c into a single matrix. The cells must contain compatibly-sized numeric or character arrays. Equivalent to recursively applying cat along each dimension.

cell2mat({[1 2], [3 4]; [5 6], [7 8]})
% [1 2 3 4; 5 6 7 8]
  • mat2cell — Split a matrix into a cell array of sub-matrices.
  • num2cell — Convert a numeric array to a cell array.
  • cell — Information about formatting, location, or contents of a cell.