Documentation

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.

char

Convert symbolic objects to character vectors

Syntax

char(A)

Description

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

Input Arguments

A

Symbolic scalar or symbolic array.

Examples

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 =
  1×54 char array
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))
char(A)
A =
[   1, 1/2, 1/3]
[ 1/2, 1/3, 1/4]
[ 1/3, 1/4, 1/5]

ans =
  1×57 char array
matrix([[1,1/2,1/3],[1/2,1/3,1/4],[1/3,1/4,1/5]])

More About

collapse all

Tips

  • char can change term ordering in an expression.

See Also

| |

Introduced before R2006a

Was this topic helpful?