Using the C++ Math Library    

Indexing Nested Cell Arrays

To index nested cells, concatenate subscripts. The first set of subscripts accesses the top layer of cells, and subsequent sets of braces access successively deeper layers of cells.

For example, array A represented in this diagram has three levels of cell nesting: the 1-by-2 cell array itself, the 2-by-2 cell array nested in cell (1,2), and the 1-by-2 cell array nested in cell (2,2).

Indexing into the First Level

To access the 2-by-2 cell array in cell (1,2):

In MATLAB A{1,2} performs the same operation.

Indexing into the Second Level

To access the 1-by-2 array in position (2,2) of cell (1,2):

A{1,2}{2,2} in MATLAB performs the same operation.

Indexing into the Third Level

To access the empty cell in position (2,2) of cell (1,2):

A{1,2}{2,2}{1,2} in MATLAB performs the same operation.


 Referencing a Subset of the Contents of a Cell Assigning Values to a Cell Array