Well, thanks to everyone that was in the discussion. To summarize, it seems that the problem has no general solution, because MatLab itself estimates the number of desired outputs before calling the function for use inside it. Three cases can be noted:
1) varargout , nOut=nargout(@fcn) .
nOut - , .
X=cell(1,nOut);
[X{:}]=fcn(inputs);
2) varargout , nOut=nargout(@fcn) . (, length(varargin)=length(varargout)).
nOut inputs .
3) fcn.
. , .