I’m fairly sure this can be avoided completely because you run your Julia code in a separate operating system process. I haven’t used matlab for a long time, but IIRC the problem here is because matlab likes to set environment variables LD_LIBRARY_PATH
(and possibly LD_PRELOAD
?) which breaks the invocation of user executables with matlab’s system
function (sigh… matlab )
This problem is described here: Why does Matlab set a custom LD_LIBRARY_PATH when execting "system" on Linux? - MATLAB Answers - MATLAB Central
The solution is to unset the necessary environment variables, or otherwise undo whatever crimes matlab has committed against your OS environment.