You need to "bind" one of the arguments to whatever value you choose. This is done with an "anonymous" function.
fx = @(x)f(x,2)
is a function that takes one input argument, x, and returns f(x,2). I have called it fx here, but of course you could call it any valid variable name. So, fx(pi) = f(pi,2). We don't have to name this function. We can just pass it to the integrator, so the answer to your question is
Of course this works with quad as well, but why do people use quad anymore when they have quadgk?