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',...
        class(A{1}),class(A{2}),class(A{3}),class(A{4}))
Classes: double uint8 double char
Was this topic helpful?