# Running a Julia script from MATLAB using system()

**URL:** <https://discourse.julialang.org/t/running-a-julia-script-from-matlab-using-system/109931>\
**Category:** General Usage\
**Tags:** package, matlab, interface\
**Created:** [February 8, 2024, 1:42pm UTC](https://discourse.julialang.org/t/running-a-julia-script-from-matlab-using-system/109931 "2024-02-08T13:42:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rakshith95](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rakshith95/32/44606_2.png) [@rakshith95](https://discourse.julialang.org/u/rakshith95)\
**Post date:** [February 8, 2024, 1:42pm UTC](https://discourse.julialang.org/t/running-a-julia-script-from-matlab-using-system/109931/1 "2024-02-08T13:42:55Z")

</div>

Hello,  
I’m trying to run a Julia `.jl` script in a MATLAB program using the [`system`](https://in.mathworks.com/help/matlab/ref/system.html) command. The script runs perfectly fine, when I attempt to do so from the terminal, but I get a segmentation fault when I try to run it through the system command.

I have to `import` a custom project as part of this script, and I think this is where it throws the error. When I try to import other modules, such as `MAT` or `LinearAlgebra` it’s fine, but when I try to import `MyPackage` it throws the segmentation fault.

Any suggestions, or paths to explore would be appreciated.

---

<div class="post-metadata">

**Author:** ![rakshith95](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rakshith95/32/44606_2.png) [@rakshith95](https://discourse.julialang.org/u/rakshith95)\
**Post date:** [February 9, 2024, 3:08pm UTC](https://discourse.julialang.org/t/running-a-julia-script-from-matlab-using-system/109931/2 "2024-02-09T15:08:26Z")

</div>

Turns out I had to remove some paths from `LD_LIBRARY_PATH`, which Matlab was adding while running `system`, which interfered with Julia somehow(?). Works fine now
