I have a 6x3 array of functions, dens, in Matlab, in which each function has a two-dimensional vector z as input. I need to evaluate these functions at z=[2 3], all at the same time; I have tried
ev_dens = @(z) cellfun(@(myfun) myfun(z),dens,'UniformOutput',false);
z =[2 3];
ev_dens(z)
but I got this error
??? Index exceeds matrix dimensions.
Error in ==> @(myfun)myfun(z)
Error in ==> @(z)cellfun(@(myfun)myfun(z),dens,'UniformOutput',false)
Could you help me?
dens(1:6,1:3)={@(x)([x(2),x(1)+x(2)])}) I don't get any error.