sym2cell
Convert symbolic array to cell array
Syntax
Description
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 =
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
{[x]} {[2 ]} {[3 ]} {[4 ]}
{[y]} {[6 ]} {[7 ]} {[8 ]}
{[9]} {[10]} {[11]} {[12]}
To access an element in each cell, use curly braces.
[C{1,1:4}]
ans =
[C{1:3,1}]
ans =
Input Arguments
S
— Input symbolic array
symbolic number | symbolic variable | symbolic expression | symbolic function | symbolic vector | symbolic matrix | symbolic multidimensional array
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
C
— Resulting cell array
cell array
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.
Version History
Introduced in R2016a
Abrir ejemplo
Tiene una versión modificada de este ejemplo. ¿Desea abrir este ejemplo con sus modificaciones?
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)