Documentation Center

  • Trial Software
  • Product Updates

char

Convert symbolic objects to strings

Syntax

char(A)

Description

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

Input Arguments

A

Symbolic scalar or symbolic array.

Examples

Convert symbolic expressions to strings, and then concatenate the strings:

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 string.

 

Convert a symbolic matrix to a string:

A = sym(hilb(3))
char(A)
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]])

More About

expand all

Tips

  • char can change term ordering in an expression.

See Also

| |

Was this topic helpful?