# Transferring a matrix from Mathematica to Julia

**URL:** <https://discourse.julialang.org/t/transferring-a-matrix-from-mathematica-to-julia/61910>\
**Category:** New to Julia\
**Tags:** interoperability, mathematica\
**Created:** [May 27, 2021, 9:52am UTC](https://discourse.julialang.org/t/transferring-a-matrix-from-mathematica-to-julia/61910 "2021-05-27T09:52:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@Thomas](https://discourse.julialang.org/u/Thomas)\
**Post date:** [May 27, 2021, 9:52am UTC](https://discourse.julialang.org/t/transferring-a-matrix-from-mathematica-to-julia/61910/1 "2021-05-27T09:52:45Z")

</div>

What is the recommended ways to transfer a matrix generated in Mathematica to Julia and benefits/disadvantages? My workflow is the following:

1. generate matrices in Mathematica
2. transfer the matrices to Julia (via some standardized data format like MatrixMarket,…)
3. use those in further applications/packages
4. going back and forth

Some other methods that I am considering is:

- call directly the function in 3 using Mathematica ExternalEvaluate
- or call 1 using Julia’s interoperability

I guess interoperability cannot be much more seamless than this. If you have any other methods please let me know.

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [May 27, 2021, 9:55am UTC](https://discourse.julialang.org/t/transferring-a-matrix-from-mathematica-to-julia/61910/2 "2021-05-27T09:55:58Z")

</div>

If I’m not mistaken Mathematica supports HDF5. Julia does as well, see [HDF5.jl](https://github.com/JuliaIO/HDF5.jl). So you could export your matrix into a HDF5 file and load it in Julia.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 27, 2021, 11:54am UTC](https://discourse.julialang.org/t/transferring-a-matrix-from-mathematica-to-julia/61910/3 "2021-05-27T11:54:49Z")

</div>

Frankly, I would just use CSV, with the standard library `DelimitedFiles` on the Julia end.

---

<div class="post-metadata">

**Author:** ![Thomas](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@Thomas](https://discourse.julialang.org/u/Thomas)\
**Post date:** [June 2, 2021, 11:51am UTC](https://discourse.julialang.org/t/transferring-a-matrix-from-mathematica-to-julia/61910/4 "2021-06-02T11:51:39Z")

</div>

Thanks guys. My matrix is sparse and big so I guess I will stick to best data format for these.
