This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

mat2str

Convert matrix to string

Syntax

str = mat2str(A)
str = mat2str(A, n)
str = mat2str(A, 'class')
str = mat2str(A, n, 'class')

Description

example

str = mat2str(A) converts fi object A to a string representation. The output is suitable for input to the eval function such that eval(str) produces the original fi object exactly.

example

str = mat2str(A, n) converts fi object A to a string representation using n bits of precision.

str = mat2str(A, 'class') creates a string representation with the name of the class of A included. This option ensures that the result of evaluating str will also contain the class information.

str = mat2str(A, n, 'class') uses n bits of precision and includes the class of A.

Examples

collapse all

Convert the fi object a to a string.

a = fi(pi);
str = mat2str(a)
str = 
'3.1416015625'

Convert the fi object a to a string using eight bits of precision.

a = fi(pi);
str = mat2str(a, 8)
str = 
'3.1416016'

Input Arguments

collapse all

Input array, specified as a scalar, vector, or matrix. A cannot be a multidimensional array.

Data Types: fi|single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Number of bits of precision in the output, specified as a positive integer.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Output Arguments

collapse all

String representation of input array, returned as a character array.

See Also

|

Introduced in R2015b