| Programming and Data Types | ![]() |
Array/String Conversion
The MATLAB function mat2str changes an array to a string that MATLAB can evaluate. This string is useful input for a function such as eval, which evaluates input strings just as if they were typed at the MATLAB command line.
A = [1 2 3; 4 5 6]
A =
1 2 3
4 5 6
mat2str returns a string that contains the text you would enter to create A at the command line.
B = mat2str(A) B = [1 2 3; 4 5 6]
| String/Numeric Conversion | Multidimensional Arrays | ![]() |