Also (it's very late in the game to add to this, but it disappoints me). Here is a solution with nested functions:
function [ dealfunchandle ] = dealwithit( arrayfunc )
% Takes as input an event function of (t,z) that returns a 3 array (in same order as event syntax).
function [a, b, c] = dealfunc(t,z)
output = arrayfunc(t,z);
a = output(:,1);
b = output(:,2);
c = output(:,3);
end
dealfunchandle = @dealfunc;
end
(, ). :
arrayfunc = @(t,y) [y(1), 0, 1];
events = dealwithit(arrayfunc);
opts = odeset('Events', events);
ode45 .