How did you try to reference it? You have to provide QP as input argument to have it available inside quadEOM. I guess:
[tsave, xsave] = ode45(@(t,s) quadEOM(t, s, controlhandle, trajhandle, params, QP), timeint, x);
But then notice, that the function to be integrated will be called even for rejected steps. It would not be useful to store the trajectories using theses points. So better use the OutputFcn, which considers accepted steps only.
I would not solve the problem in this indirect nested way. Better let ODE45 calculate the trajectory and call quadEOM afterwards with tsave, xsave as inputs. Now let quadEOM reply the needed parameters if nargout > 1:
function [ds, extraOutput] = quadEOM(t, s, controlhandle, trajhandle, ...
params)
% Consider that [t] is a vector and [s] a matrix.
ds = ...
if nargout > 1
extraOutput = ...
end