matlab-to-julia icon indicating copy to clipboard operation
matlab-to-julia copied to clipboard

Translating functions with variable number of arguments

Open sbacelar opened this issue 5 years ago • 1 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 < ´.

sbacelar avatar May 14 '19 15:05 sbacelar

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

aminya avatar Jul 04 '19 02:07 aminya