Using the C Math Library | ![]() ![]() |
Overview
A cell array is a regularly shaped N-dimensional array of cells. Each cell is capable of containing any type of MATLAB data, including another cell arrays. When using cell arrays, you must be careful to distinguish between the data values stored in the cells and the cells themselves, which are data values in their own right.
MATLAB supports two types of indexing on cell arrays. The first, standard indexing, uses parentheses ()
and allows you to manipulate the cells in a cell array. The second, cell array indexing, uses braces {}
to manipulate the data values stored in the cells.
The following sections use this sample cell array, N
, as an example. The cell array N
contains a 2-by-2 double array, a string array, a complex number, and a scalar array. (For information about creating cell arrays in a C program, seeCell Arrays.)
Tips for Working with Cell Arrays
N(2,2)+1
, which attempts to add one to a cell. However, N{2,2}+1
works perfectly well, since the cell array indexing returns the contents of cell (2,2)
rather than the cell itself.This documentation focuses on two-dimensional cell arrays. If N
were a cell array of higher dimension, the examples would still work on N
if you added the appropriate number of dimensions to the indexing expressions.
![]() | Cell Array Indexing | Referencing a Cell in a Cell Array | ![]() |