Products & Services Solutions Academia Support User Community Company

Learn more about Symbolic Math Toolbox   

char - Convert symbolic objects to strings

Syntax

char(A)
char(A, d)

Description

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

char(A, d) converts a symbolic scalar or array to a string. For symbolic arrays, the second parameter specifies the form of the resulting string. For symbolic scalars, this parameter does not affect the result. d will be removed in a future release.

Inputs

A

A symbolic scalar or a symbolic array

d

d will be removed in a future release.

A number that specifies the format of the resulting string. For symbolic arrays:

char (A, 1) results in matrix([...])

char(A, 2) results in matrix([[...],[...]])

char(A, d) for all other values of the parameter d results in array([1..m, 1..n, 1..p], [(1,1,1) = xxx,...,(m,n,p ) = xxx])

Examples

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

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

The result is:

name =
x^3 + x^2 + 2*x - 1 presents a polynomial expression

Convert a symbolic matrix to a string:

A = sym(hilb(3))
char(A)

The result is:

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]])

See Also

double | pretty | sym

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS