lakras / matlab-to-julia

Translates MATLAB source code into Julia. Can be accessed here: https://lakras.github.io/matlab-to-julia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Translating functions with variable number of arguments

sbacelar opened this issue · comments

In MatLab I found code of the type:

function[x, y]=foo(a,b,c)
    if nargin < 3
       # do something
    end
    if nargin < 2
       # do another thing
    end
end

I think this should be translated into Julia by:

function foo(args...)
    if length(args) <3
        # more code
    return x,y
end

But the automatic translator mantains ´if nargin < ´.

Yes, I noticed this as well. Translator now just ignores when it does not understand something. This can be enhanced.