This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Convert symbolic objects to character vectors




char(A) converts a symbolic scalar or a symbolic array to a character vector.

Input Arguments


Symbolic scalar or symbolic array.


Convert symbolic expressions to character vectors, and then concatenate the character vectors:

syms x
y = char(x^3 + x^2 + 2*x - 1);
name = [y, ' represents a polynomial expression']
name =
    '2*x + x^2 + x^3 - 1 represents a polynomial expression'

Note that char changes the order of the terms in the resulting character vector.

Convert a symbolic matrix to a character vector:

A = sym(hilb(3))
A =
[   1, 1/2, 1/3]
[ 1/2, 1/3, 1/4]
[ 1/3, 1/4, 1/5]

ans =
    'matrix([[1, 1/2, 1/3], [1/2, 1/3, 1/4], [1/3, 1/4, 1/5]])'


  • char can change term ordering in an expression.

See Also

| |

Introduced before R2006a

Was this topic helpful?