I tried both and, after making some corrections (because are meant for Julia 0.6), I was able to compile the mex file. Following the instructions on the README of both mexjulia and jlcall I was not able to execute the simple jl.call('2+2').
Several issues and in most of the times the MATLAB crashes.

I didnāt even try (didnāt need to), but Iāve called in the other direction. And also to Octave (a MATLAB clone).

Thatās not a really useful to know information (unless you can do callbacks), but I bring it up as there may be other options.

I didnāt call Octave directly, I call Python, and through Oct2Py indirectly to Octave (it works, one ābugā, and I posted a workaround elsewhere). Itās not as clean, but basically no boilerplate (I guess would be similar in other direction), looks like e.g. this:

So I was thinking, maybe you can call from MATLAB (or Octave) to Python instead, and then to Julia through pyjulia package. Should work, as I found to Python is a supported MATLAB option:

And something similar for Octave (Iām not sure how good this is):

[For me, I could have used Octave in production, if it was up to me, but I was using it as a cruch while porting, and I actually completed a project, fully ported to Julia. Whatās you (long-term) goal?]

thanks @jebej for the suggestion!
I tried to follow the steps on the REAMDE, but I was not able to proceed with the build step.
What should I run on the MATLAB side to start the build?

Thanks for the answer @Palli!
Indeed what you suggest would have been easier, but I need to send Julia models to MATLAB users.
Thatās why I am looking into thatā¦

About calling to Python first and then to Julia, it could be an option, although it increases the overhead.
I hope @jebejās fork could do the trick otherwise I will follow your path!

Itās not clear to me, that changes much. You need to have julia (the runtime) set up, and not a problem, with calling to Python first you need it set up too. For my direction, thereās no great overhead to call Python, at least way more (still not a problem) from there to Octave (Oct2Py, transmits data back and forth my writing to files).

My understanding is pyjulia is as efficient as PyCall.jl (basically implemented by it, should be same overhead, meaning āno copyingā).

SharedMATLABEngine goes through a PyCall and the uses the matlab.engine interface in Python.

I believe itās only to call in the othe direction, but I could be wrong or there be a workaround (callbacks, since Python used, seems like it similar to pyjulia implemented).

Yes, I used your fork
I installed MATLAB.jl on Julia but for the Mex.jl I got an error that it couldnāt find matlab. So, I tried to re-install it and it seemed that it worked, so now both (MATLAB.jl and Mex.jl) are visible in the Julia.
Moving to the MATLAB environment I was not able to find how to compile the mex fileā¦

right!!!
and the error is: ERROR: LoadError: MATLAB.MEngineError("failed to get variable matlab_jl_has_ans from MATLAB session")
Do you think I miss something on the matlab side?

You no longer need the āconfigā .
The jl.config is for the other way of compiling the mex in Matlab.
But you already did it, in Julia.
That is why you can run the ā2+2ā .