I'm trying to define an anonymous function that calls a version of a function that returns multiple outputs.
For example, the function find
has two possible output forms:
[row,col] = find(X);
and
[ind] = find(X);
Say I would like to choose the first form inside of an anonymous function.
I have tried 1)
get_columns = @(x) x(2);
and 2)
get_columns = @(x,y) y;
But when I call:
get_columns(find(x))
The first version of get_columns
thinks I am calling find
as [ind] = find(X)
and not as [row,col] = find(X);
, while the second one complains with "Not enough input arguments"
.
Is there a way to trigger a specific output form of a function inside an anonymous function?