Main Content

Combining Cell Arrays with Non-Cell Arrays

Combining a number of arrays in which one or more is a cell array returns a new cell array. Each of the original arrays occupies a cell in the new array:

A = [100, {uint8(200), 300}, 'MATLAB'];
whos A
  Name      Size            Bytes  Class    Attributes

  A         1x4               477  cell

Each element of the combined array maintains its original class:

fprintf('Classes: %s %s %s %s\n',...
Classes: double uint8 double char