sym2cell
Converts a symbolic array into a cell array.
Category: Symbolic Computations in MATLAB > Conversion Between Symbolic and Numeric
Syntax
C = sym2cell(S)
Splits the symbolic array S into a cell array of the same size, one symbolic scalar per cell.
Description
This turns a symbolic matrix into cells that can be indexed with braces, passed through cellfun, or fed to functions that do not accept symbolic arrays. A symbolic scalar gives a 1x1 cell.
The reverse operation is cell2sym.
Input arguments
S- Symbolic scalar, vector or matrix.
Output arguments
C- Cell array with the size of
S. Each cell holds a symbolic scalar.
Example
Matrix to cells
syms x
c = sym2cell([x, 2*x; 3, x^2]);
class(c)
c{1, 2}
size(c)
Output
ans = 'cell'
ans = 2*x
ans = 1×2
2 2