title: Evaluating functions with multiple return values in the debugger
body: <p>Suppose I have some function <code>foo</code> (not written by me) that returns multiple values, like this:</p>
  
  <pre><code>function [one, two, three, four] = foo()
      one = 2;
      two = 4;
      three = 8;
      four = 16;
  end
  </code></pre>
  
  <p>(NB: the above is just an example; in general, I have no control over the function <code>foo</code>.)</p>
  
  <p>Furthermore, suppose that I'm in the middle of a MATLAB debugging session.</p>
  
  <p>If I now evaluate <code>foo</code>, only the first of the values it returns gets displayed:</p>
  
  <pre><code>K&gt;&gt; foo()
  ans =
       2
  </code></pre>
  
  <p>If I try to capture all the values with an assignment expression, I get one error or another; for example:</p>
  
  <pre><code>K&gt;&gt; all_returned_values = foo()
  Attempt to add "all_returned_values" to a static workspace.
   See Variables in Nested and Anonymous Functions.
  
  K&gt;&gt; [v1 v2 v3 v4] = foo()
  Attempt to add "v1" to a static workspace.
   See Variables in Nested and Anonymous Functions.
  
  K&gt;&gt; {v1 v2 v3 v4} = foo()
   {v1 v2 v3 v4} = foo()
                 ↑
  Error: The expression to the left of the equals sign is not a valid target for an assignment.
  </code></pre>
  
  <p>Is there a way to force MATLAB to return all the values of the function that does <em>not</em> rely on an assignment?</p>
  
  <p>NB: I'm looking for a solution that does not require modifying the function <code>foo</code> in any way.  (This function may not be under my control; e.g., it could be a built-in MATLAB function.)</p>