3.13. Cell Arrays

A cell array is an array of cells. Each cell stores an array. The elements of an array in a cell are all of the same type but two different cells may have different type of elements. For example, one cell of a cell array might contain array of numeric values, another cell may contain an array of text strings, and the third cell may store an array of complex values.

3.13.1. Creating Cell Arrays

The cell function creates empty cell arrays of the specified size. For example, to create an empty cell array sample of size 2-by-2, the following command is used:

sample = cell(2,2);

The cell array can then be built by assigning data to individual cells, one cell at a time. Data can be assigned in two ways: cell indexing and content ...

Get MATLAB® and Its Applications in Engineering: [Based on MATLAB 7.5 (R2007b)] now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.