borglab/wrap

Matlab default arguments

Closed this issue · 1 comments

This is the "correct fix" for borglab/gtsam#954. Needed by @mattking-smith

Notice, for example, that in the unit tests, the default argument tests are actually not correct. For example,

function varargout = DefaultFuncInt(varargin)
if length(varargin) == 2 && isa(varargin{1},'numeric') && isa(varargin{2},'numeric')
functions_wrapper(8, varargin{:});
else
error('Arguments do not match any overload of function DefaultFuncInt');
end

This should be something more like

function varargout = DefaultFuncInt(varargin)
      if length(varargin) == 2 && isa(varargin{1},'numeric') && isa(varargin{2},'numeric')
        functions_wrapper(8, varargin{:});
      else if length(varargin) == 1 && isa(...)
        ...
      else if length(varargin) == 0
        ...
      else
        error('Arguments do not match any overload of function DefaultFuncInt');
      end

Aha you are correct sir. Good call.