| MATLAB Function Reference | ![]() |
Convert a matrix into a string
Syntax
str = mat2str(A) str = mat2str(A,n)
Description
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.
Limitations
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.
Examples
A =
1 2
3 4
b = mat2str(A)
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.
See Also
| magic | material | ![]() |