# sym2cell

Convert symbolic array to cell array

## Syntax

``C = sym2cell(S)``

## Description

example

````C = sym2cell(S)` converts a symbolic array `S` to a cell array `C`. The resulting cell array has the same size and dimensions as the input symbolic array.```

## Examples

### Convert Symbolic Array to Cell Array

Convert a matrix of symbolic variables and numbers to a cell array.

Create the following symbolic matrix.

```syms x y S = [x 2 3 4; y 6 7 8; 9 10 11 12]```
```S = [ x, 2, 3, 4] [ y, 6, 7, 8] [ 9, 10, 11, 12]```

Convert this matrix to a cell array by using `sym2cell`. The size of the resulting cell array corresponds to the size of the input matrix. Each cell contains an element of the symbolic matrix `S`.

`C = sym2cell(S)`
```C = 3×4 cell array {1×1 sym} {1×1 sym} {1×1 sym} {1×1 sym} {1×1 sym} {1×1 sym} {1×1 sym} {1×1 sym} {1×1 sym} {1×1 sym} {1×1 sym} {1×1 sym}```

To access an element in each cell, use curly braces.

`[C{1,1:4}]`
```ans = [ x, 2, 3, 4]```
`[C{1:3,1}]`
```ans = [ x, y, 9]```

## Input Arguments

collapse all

Input symbolic array, specified as a symbolic vector, matrix, or multidimensional array. `S` also can be a scalar, that is, a symbolic number, variable, expression, or function.

## Output Arguments

collapse all

Resulting cell array, returned as a cell array such that ```size(C) = size(S)```. Each element of the input symbolic array `S` is enclosed in a separate cell.