Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matlab default arguments #134

Closed
gchenfc opened this issue Dec 9, 2021 · 1 comment · Fixed by #135
Closed

Matlab default arguments #134

gchenfc opened this issue Dec 9, 2021 · 1 comment · Fixed by #135
Assignees

Comments

@gchenfc
Copy link
Member

gchenfc commented Dec 9, 2021

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
@varunagrawal
Copy link
Collaborator

Aha you are correct sir. Good call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants