Programming Previous page   Next Page

Obtaining Data from Cell Arrays

You can obtain data from cell arrays and store the result as either a standard array or a new cell array. This section covers

Accessing Cell Contents Using Content Indexing

You can use content indexing on the right side of an assignment to access some or all of the data in a single cell. Specify the variable to receive the cell contents on the left side of the assignment. Enclose the cell index expression on the right side of the assignment in curly braces. This indicates that you are assigning cell contents, not the cells themselves.

Consider the 2-by-2 cell array N:

You can obtain the string in N{1,2} using

To obtain subsets of a cell's contents, concatenate indexing expressions. For example, to obtain element (2,2) of the array in cell N{1,1}, use

Accessing a Subset of Cells Using Cell Indexing

Use cell indexing to assign any set of cells to another variable, creating a new cell array. Use the colon operator to access subsets of cells within a cell array.

Previous page  Creating Cell Arrays Deleting Cells Next page

© 1994-2005 The MathWorks, Inc.