Embedded Julia in MATLAB
JuliaLAB is a MEX library that links against libjulia. It uses Julia's and MATLAB's C APIs to call functions, convert and pass data between languages, and handle exceptions.
- Either add
JuliaLAB/src
to the MATLAB path or change to that directory. - Run
julia_compile(<path_to_julia-config.jl>)
. - Run
julia_eval(<str>)
orjulia_call(<function_name>, arg1, arg2, ...)
All MATLAB variables are converted to Julia arrays of at least 2 dimensions (as this is how MATLAB arrays are represented).
The library is largely incomplete at the moment, but more features are coming. Currently the functions will:
- Evaluate the function or string.
- If a Julia exception occurred, throw a MATLAB exception.
- If the result of the evaluation was a
Float64
, print it and returntrue
, else returnfalse
.
There is currently a major bug that causes MATLAB to crash sometime after running these functions. I would appreciate your help! See this thread and this gist.
- Julia 0.3+
- MATLAB (tested on 2012b, but should work with older versions)
JuliaLAB is MIT licensed.