Say that I have a function foo defined as
[a b] = foo(c ).
If I consider a function handle
f = @(c)foo(c)
to be used e.g. in a cellfun call, what I get is an f behaving equivalently to a foo defined like
a = foo(c)
i.e., the returned value b gets lost.
Therefore, when such an f is put in a cellfun call, the output cell will have just the as and will miss the bs (which I currently care about). Visually
cellfun(f,input)
[a(input{1})] ?
[a(input{2})] ?
.... b gets killed along the way
Question: how to define a function handle to foo which catches just the bs? i.e. giving a behavior analogous to a definition of foo like
b = foo(c)
i.e.^2, wasting the as.
Moreover, is it possible to (efficiently) catch both a and b in a unique cellfun call?