I have a function of the following form
function [out1, out2] = demo_fcn( in )
out1 = in(1);
out2 = in(2);
which gets called by
[out1, out2] = @(x) demo_fcn(x);
but anonymous functions are not allowed more than one outputs. This is clearly a simplified example, the application is for a nonlinear programming problem where out1 is the objective function and out2 is the gradient calculation. I am not sure how I can structure this differently or in a way which is acceptable by MATLAB syntax.
Note the error messge is
Only functions can return multiple values.