Programming and Data Types    

Replacing Lists of Variables with Cell Arrays

Cell arrays can replace comma-separated lists of MATLAB variables in:

If you use the colon to index multiple cells in conjunction with the curly brace notation, MATLAB treats the contents of each cell as a separate variable. For example, assume you have a cell array T where each cell contains a separate vector. The expression T{1:5} is equivalent to a comma-separated list of the vectors in the first five cells of T.

Consider the cell array C.

To convolve the vectors in C(1) and C(2) using conv,

Display vectors two, three, and four with

Similarly, you can create a new numeric array using the statement

You can also use content indexing on the left side of an assignment to create a new cell array where each cell represents a separate output argument.

You can display the actual eigenvalues and eigenvectors using D{1} and D{2}.


  Deleting Cells Applying Functions and Operators