A cell array is a data type with indexed data containers called
cells, where each cell can contain any type of
data. Cell arrays commonly contain either lists of character vectors of
different lengths, or mixes of strings and numbers, or numeric arrays of
different sizes. Refer to sets of cells by enclosing indices in smooth
parentheses, ()
. Access the contents of cells by indexing
with curly braces, {}
. For more information, see Access Data in Cell Array or watch Introducing Structures and Cell Arrays.
cell | Cell array |
cell2mat | Convert cell array to ordinary array of the underlying data type |
cell2struct | Convert cell array to structure array |
cell2table | Convert cell array to table |
celldisp | Display cell array contents |
cellfun | Apply function to each cell in cell array |
cellplot | Graphically display structure of cell array |
cellstr | Convert to cell array of character vectors |
iscell | Determine if input is cell array |
iscellstr | Determine if input is cell array of character vectors |
mat2cell | Convert array to cell array whose cells contain subarrays |
num2cell | Convert array to cell array with consistently sized cells |
strjoin | Join strings in array |
strsplit | Split string or character vector at specified delimiter |
struct2cell | Convert structure to cell array |
table2cell | Convert table to cell array |
A cell array is a data type with indexed data containers called cells. Each cell can contain any type of data.
Create a cell array using the {}
operator or the
cell
function.
Read and write data from and to a cell array.
Pass Contents of Cell Arrays to Functions
These examples show several ways to pass data from a cell array to a function that does not recognize cell arrays as inputs.
Preallocate Memory for Cell Array
Initialize and allocate memory for a cell array.
This example compares cell and structure arrays, and shows how to store data in each type of array. Both cell and structure arrays allow you to store data of different types and sizes.