If a Matlab function returns a variable number of values, how can I get all of them as a cellarray,
- by kaleidomedallion
I am writing a function to remove some values from a cellarray, like so:
function left = remove(cells, item);
left = cells{cellfun(@(i) ~isequal(item, i), cells)};
But when I run this, left 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 cellarray?
Also, perhaps there is already a way to remove a given item from a cellarray? I could not find it in the documentation.