title: If a MATLAB function returns a variable number of values, how can I get all of them as a cell array?
body: <p>I am writing a function to remove some values from a cell array, like so:</p>
  
  <pre><code>function left = remove(cells, item);
  left = cells{cellfun(@(i) ~isequal(item, i), cells)};
  </code></pre>
  
  <p>But when I run this, <code>left</code> has only the first value, as the call to cells{} with a logical array returns all of the matching cells as separate values.  How do I group these separate return values into a single cell array?</p>
  
  <p>Also, perhaps there is already a way to remove a given item from a cell array?  I could not find it in the documentation.</p>