| MATLAB Function Reference | Search  Help Desk |
| mat2str | Examples See Also |
Convert a matrix into a string
str = mat2str(A) str = mat2str(A,n)
str = mat2str(A)
converts matrix A into a string, suitable for input to the eval function, using full precision.
str = mat2str(A,n)
converts matrix A using n digits of precision.
The mat2str function is intended to operate on scalar, vector, or rectangular array inputs only. An error will result if A is a multidimensional array.
Consider the matrix:
A =
1 2
3 4
The statement
b = mat2str(A)
produces:
b = [1 2 ;3 4 ]where
b is a string of 11 characters, including the square brackets, spaces, and a semicolon.
eval(mat2str(A)) reproduces A.
int2str Integer to string conversion
sprintf Write formatted data to a string
str2num String to number conversion