Make sure that in all cases, you assign something to varargout . This includes cases where you return early because the parameters are not correct (unless you use error() for that case.)
One of the common difficulties that people have is that they have something like
for K = 1 : SomeLimit
OutputParameter(K) = SomeValue
end
but forget to take into account the possibility that the SomeLimit might be less than the initial value, causing the for loop to not be done at all. If your only assignment to a variable is in a for loop then you need to be sure that the for loop will always be executed at least once -- or, alternately, that the variable is given a definite value before the for loop so that it will have a value even if the for loop does not execute the body at all.