Convert matrix to characters
chr = mat2str(
converts the numeric
matrix X
)X
into a character vector that represents the matrix, with
up to 15 digits of precision.
You can use chr
as input to the eval
function. For example, A = eval(chr)
reproduces the values from
the original matrix to the precision specified in chr
.
chr = mat2str(___,'class')
includes the name of
the class, or data type, of X
in chr
. You can
use this syntax with any of the arguments from the previous syntaxes.
If you use this syntax to produce chr
, then A =
eval(chr)
also reproduces the data type of the original matrix.
mat2str
returns character arrays only. Starting in
R2016b, you can convert numeric arrays to string arrays using the string
function.