## CELL Cell Array Definitions

Section: Variables and Arrays

### Usage

The cell array is a fairly powerful array type that is available in FreeMat. Generally speaking, a cell array is a heterogenous array type, meaning that different elements in the array can contain variables of different type (including other cell arrays). For those of you familiar with`C`

, it is the equivalent to the
`void *`

array. The general syntax for their construction is
A = {row_def1;row_def2;...;row_defN}

where each row consists of one or more elements, seperated by commas

row_defi = element_i1,element_i2,...,element_iM

Each element can be any type of FreeMat variable, including matrices, arrays, cell-arrays, structures, strings, etc. The restriction on the definition is that each row must have the same number of elements in it.

### Examples

Here is an example of a cell-array that contains a number, a string, and an array--> A = {14,'hello',[1:10]} A = [14] [hello] [1 10 double array]

Note that in the output, the number and string are explicitly printed, but the array is summarized. We can create a 2-dimensional cell-array by adding another row definition

--> B = {pi,i;e,-1} B = [3.14159] [0+1i] [2.71828] [-1]

Finally, we create a new cell array by placing `A`

and `B`

together

--> C = {A,B} C = [1 3 cell array] [2 2 cell array]