juliamatlab / mexjulia

embedding Julia in the MATLAB process.
MIT License
52 stars 14 forks source link

jl.mexn has multi-output, but jl.call does not #49

Open standarddeviant opened 7 years ago

standarddeviant commented 7 years ago

This is related to https://github.com/twadleigh/mexjulia/issues/48 because I can't figure out how to get multiple outputs from a julia function.

Again, with this as the example:

# nargoutTest.jl
function nargoutTest(a,b)
  @show a, b
  return "outp1", "outpTWO"
end

I can't figure out how to cleanly get both outputs. I tried

jl.include('nargoutTest.jl')
[a,b] = jl.mexn(2,'nargoutTest',3,2)

That crashes MATLAB 2016b, Win10, x86-64 consistently. Given that mexn isn't in the README.md, I think I might be misusing it...

But at the moment, jl.call has no options for multiple outputs. Is this functionality a technical limitation, or something straightforward that just needs to be implemented?

standarddeviant commented 7 years ago

I think I see a solution to this after looking at the code, but am learning how mexjulia passes data around and how varargout works.