# How to read julia variables with Matlab

**URL:** https://discourse.julialang.org/t/how-to-read-julia-variables-with-matlab/69230
**Category:** New to Julia
**Tags:** question
**Created:** [October 5, 2021, 10:57am UTC](https://discourse.julialang.org/t/how-to-read-julia-variables-with-matlab/69230 "2021-10-05T10:57:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![iiitr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iiitr/32/24586_2.png) [@iiitr](https://discourse.julialang.org/u/iiitr)
#### Post date: [October 5, 2021, 10:57am UTC](https://discourse.julialang.org/t/how-to-read-julia-variables-with-matlab/69230/1 "2021-10-05T10:57:21Z")

</div>

Hi all,

I am looking for a simple way to save julia variables, and use Matlab to read them, and finally become variables in Matlab

For example, I have a 3-D array:

```julia
x = rand(2, 3, 4)

```

My current approach is to use the XLSX.jl package to save the variables as an Excel file. There are 4 sheets in this file, and each sheet is a 2x3 array.

Then, I wrote an m-function in Matlab to read them so that I can use the plotting function of Matlab

Although there are many drawing packages in julia, I am very familiar with the drawing function of matlab, and it is very convenient to save matlab pictures to Microsoft Visio.

However, the interaction with Excel is very slow, whether in julia or matlab.

Thanks a lot!

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [October 5, 2021, 11:06am UTC](https://discourse.julialang.org/t/how-to-read-julia-variables-with-matlab/69230/2 "2021-10-05T11:06:08Z")

</div>

Using [MAT.jl](https://github.com/JuliaIO/MAT.jl) might be the easiest.

Linking [this announcement](https://discourse.julialang.org/t/ann-juliafrommatlab-jl-call-julia-from-matlab/66882) too, just in case.

---

<div class="post-metadata">

### Author: ![blob](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@blob](https://discourse.julialang.org/u/blob)
#### Post date: [October 5, 2021, 11:16am UTC](https://discourse.julialang.org/t/how-to-read-julia-variables-with-matlab/69230/3 "2021-10-05T11:16:11Z")

</div>

Maybe try calling Matlab from Julia: [https://github.com/JuliaInterop/MATLAB.jl](https://github.com/JuliaInterop/MATLAB.jl) ?

---

<div class="post-metadata">

### Author: ![iiitr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iiitr/32/24586_2.png) [@iiitr](https://discourse.julialang.org/u/iiitr)
#### Post date: [October 5, 2021, 11:36am UTC](https://discourse.julialang.org/t/how-to-read-julia-variables-with-matlab/69230/4 "2021-10-05T11:36:51Z")

</div>

Thank you very much! It is indeed the easiest way for me.

---

<div class="post-metadata">

### Author: ![iiitr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iiitr/32/24586_2.png) [@iiitr](https://discourse.julialang.org/u/iiitr)
#### Post date: [October 5, 2021, 11:37am UTC](https://discourse.julialang.org/t/how-to-read-julia-variables-with-matlab/69230/5 "2021-10-05T11:37:20Z")

</div>

Thank you to your reply!
