Using the C Math Library    

Displaying the Contents of a Cell Array

When you use mlfPrintMatrix() or mlfDisp() to display a cell array, the MATLAB C Math Library displays the type of array stored in each cell but it does not display the contents of the cell (except for string arrays and scalar values). To view the contents of each cell, you must use the mlfCelldisp() routine.

The mlfCelldisp() routine supports a second, optional argument which specifies the text string used to identify each cell in the output. In the example, the character "D" is passed to mlfCelldisp() as its second argument. This appears in the output in the line that prefixes each cell, such as "D{1} =". If you do not specify this second argument, mlfCelldisp() uses the text string "ans", as in "ans{1} =".

The following code fragment creates a cell array and prints out the cell array using both mlfPrintMatrix() and mlfCelldisp().

This code produces the following output:

 Creating Cell Arrays MATLAB Structures