How can I access both arguments of ismember
when it is used inside splitapply
?
slitapply
only returns scalar values for each group, so in order to compute nonscalar values for each group (as returned by the first argument of ismemebr
), one has to enclose the anonymous function (in this case ismember
) inside curly brackets {}
to return a cell array.
But now, when I provide two output arguments to splitapply
, I get an error:
Output argument "varargout{2}" (and maybe others) not assigned during call to
"@(x,y) {ismember(x,y)}"
ADD 1
I can create another function, say, ismember2cell
which would apply ismember
and turn outputs into cell arrays:
function [a, b] = ismember2cell(x,y)
[a,b] = ismember(x,y);
a = {a};
b = {b};
end
but maybe there is a solution which doesn't require this workaround.