11.6 Variable-length Return Lists

It is possible to return a variable number of output arguments from a
function using a syntax that’s similar to the one used with the
special varargin parameter name. To let a function return a
variable number of output arguments the special output parameter name
varargout is used. As with varargin, varargout is
a cell array that will contain the requested output arguments.

As an example the following function sets the first output argument to
1, the second to 2, and so on.