Programming |
A cell array provides a storage mechanism for dissimilar kinds of data. You can store arrays of different types and/or sizes within the cells of a cell array. For example, you can store a 1-by-50 char array, a 7-by-13 double array, and a 1-by-1 uint32 in cells of the same cell array.
This illustration shows a cell array that contains arrays of: unsigned integers (cell 1,1), strings (cell 1,2), complex numbers (cell 1,3), floating-point numbers (cell 2,1), signed integers (cell 2,2), and another cell array (cell 2,3).
To access data in a cell array, you use the same matrix indexing as with other MATLAB matrices and arrays. However, with cell array indexing, you use curly braces, {}
, instead of square brackets an parentheses around the array indices. For example, A{2,5}
accesses the cell in row 2 and column 5 of cell array A
.
Note The examples in this section focus on two-dimensional cell arrays. For examples of higher-dimension cell arrays, see Multidimensional Arrays. |
The following list summarizes the contents of this section:
Function Summary | Creating Cell Arrays |
© 1994-2005 The MathWorks, Inc.