Using the C Math Library    

Referencing a Subset of a Cell Array 

To obtain a subset of the cells in a cell array, use the colon index or a vector or matrix index to access a group of cells. For example, to extract the second row of the cell array N, write this code:

The result, B, is a 1-by-2 cell array containing the complex number 2-4i and the integer 7.

B = N(2,:) performs the same operation in MATLAB.

Cell arrays support vector-based (one-dimensional) indexing as well. To extract the first and last elements of N, first make a vector v that contains the integers 1 and 4 (use mlfHorzcat() to construct v). Then call mlfIndexRef() like this:

The result, B, is a 1-by-2 cell array that contains a 2-by-2 matrix (element (1,1) of N) and the scalar 7 (element (2,2) of N).

B = N([1 4]) performs the same operation in MATLAB.


 Referencing a Cell in a Cell Array Referencing the Contents of a Cell