Well I'm late to the party, but I was going to add that it seems like you're trying to accomodate something I don't understand here. I don't see why a factorial function needs two arguments. It seems to expect vector inputs, but your usage suggests that you expect it to work with scalar inputs.
I'm just going to throw this out there. There are probably canonical ways, but off the top of my head, either of these would work for scalar inputs. If you need vector support, things get more complicated (see below).
function retval = fac2(n)
function retval = fac3(n)
If you want to handle vector (or array) inputs, there are simple ways to expand on the scalar solutions (e.g use a loop). Alternatively, when looking at the second example, it becomes apparent that the cumulative product from 1:n contains all of the factorials from 1! to n!. The solution this suggests is to basically make a lookup table.
function retval = fac4(n)
retval = cumprod([1 1:nmax]);
retval = reshape(retval(n+1),s);
Bear in mind that there are other things that a general factorial function would need to be safe. You'd want to make sure inputs aren't negative, and you'd probably want to guard against non-integer-valued inputs.