In matlab, evaluating a variable without a semicolon causes it to be printed on the console output. disp is similar but does not include the variable name. Is there a way to get either console output as a string?
e.g.
>> x = [-1; 2];
>> x
x =
-1
2
Is there a way to get this output assigned to a variable in a string, i.e. in this example the string "x = \n\n -1\n 2\n"