# Error in "using MAT"

**URL:** <https://discourse.julialang.org/t/error-in-using-mat/14143>\
**Category:** New to Julia\
**Tags:** matlab\
**Created:** [August 27, 2018, 3:47pm UTC](https://discourse.julialang.org/t/error-in-using-mat/14143 "2018-08-27T15:47:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![complexfilter](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@complexfilter](https://discourse.julialang.org/u/complexfilter)\
**Post date:** [August 27, 2018, 3:47pm UTC](https://discourse.julialang.org/t/error-in-using-mat/14143/1 "2018-08-27T15:47:48Z")

</div>

I have trouble using MAT in Julia 1.0.0

_[Info:_\* Precompiling MAT [23992714-dd62-5051-b70f-ba57cb901cac]

**ERROR:** LoadError: LoadError: syntax: extra token “MatlabHDF5File” after end of expression

Stacktrace:

[1] **include** at **./boot.jl:317** [inlined]

[2] **include\_relative(** ::Module, ::String **)** at **./loading.jl:1038**

[3] **include** at **./sysimg.jl:29** [inlined]

[4] **include(** ::String **)** at **/Users/complexfilter/.julia/packages/MAT/Pn0pR/src/MAT.jl:27**

[5] top-level scope at **none:0**

[6] **include** at **./boot.jl:317** [inlined]

[7] **include\_relative(** ::Module, ::String **)** at **./loading.jl:1038**

[8] **include(** ::Module, ::String **)** at **./sysimg.jl:29**

[9] top-level scope at **none:2**

[10] **eval** at **./boot.jl:319** [inlined]

[11] **eval(** ::Expr **)** at **./client.jl:389**

[12] top-level scope at **./none:3**

in expression starting at /Users/complexfilter/.julia/packages/MAT/Pn0pR/src/MAT\_HDF5.jl:39

in expression starting at /Users/complexfilter/.julia/packages/MAT/Pn0pR/src/MAT.jl:31

**ERROR:** Failed to precompile MAT [23992714-dd62-5051-b70f-ba57cb901cac] to /Users/complexfilter/.julia/compiled/v1.0/MAT/3FHIv.ji.

Stacktrace:

[1] **error(** ::String **)** at **./error.jl:33**

[2] **macro expansion** at **./logging.jl:313** [inlined]

[3] **compilecache(** ::Base.PkgId, ::String **)** at **./loading.jl:1184**

[4] **\_require(** ::Base.PkgId **)** at **./logging.jl:311**

[5] **require(** ::Base.PkgId **)** at **./loading.jl:852**

[6] **macro expansion** at **./logging.jl:311** [inlined]

[7] **require(** ::Module, ::Symbol **)** at **./loading.jl:834**

---

<div class="post-metadata">

**Author:** ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)\
**Post date:** [August 27, 2018, 3:50pm UTC](https://discourse.julialang.org/t/error-in-using-mat/14143/2 "2018-08-27T15:50:13Z")

</div>

Install Julia 0.7 and try again. There you will get nice warnings instead of errors.

---

<div class="post-metadata">

**Author:** ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)\
**Post date:** [August 27, 2018, 3:55pm UTC](https://discourse.julialang.org/t/error-in-using-mat/14143/3 "2018-08-27T15:55:14Z")

</div>

More information: [PSA: use Julia 0.7 if you are upgrading](https://discourse.julialang.org/t/psa-use-julia-0-7-if-you-are-upgrading/13321)

---

<div class="post-metadata">

**Author:** ![masiddique](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/masiddique/32/5542_2.png) [@masiddique](https://discourse.julialang.org/u/masiddique)\
**Post date:** [September 28, 2018, 3:33pm UTC](https://discourse.julialang.org/t/error-in-using-mat/14143/4 "2018-09-28T15:33:13Z")

</div>

I have the same problem. Can’t find any solution. It used to work properly until I upgraded Julia from 0.6 to 1.0.

---

<div class="post-metadata">

**Author:** ![jaakkor2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jaakkor2/32/2540_2.png) [@jaakkor2](https://discourse.julialang.org/u/jaakkor2)\
**Post date:** [October 1, 2018, 6:28am UTC](https://discourse.julialang.org/t/error-in-using-mat/14143/5 "2018-10-01T06:28:07Z")

</div>

The issue is that MAT.jl has not been updated to Julia v1.0. There are already many overlapping PRs at [Pull requests · JuliaIO/MAT.jl · GitHub](https://github.com/JuliaIO/MAT.jl/pulls) but even the master branch looks a bit stalled.

See

> [@Syntax issue in MAT package](https://discourse.julialang.org/t/syntax-issue-in-mat-package/14843):
>
> In the MAT\_v5.jl of MAT Package, I’ve seen the following definition type Matlabv5File \<: HDF5.DataFile ios::IOStream swap\_bytes::Bool varnames::Dict{String, Int64} Matlabv5File(ios, swap\_bytes) = new(ios, swap\_bytes) end But after I went through the julia syntax documentation, I didn’t find any that can define a composite type using “type…end”. Isn’t is supposed to be “struct…end”? Does the author of the package define his own keyword? Could any explain this? Thanks.

The discourse tags “Usage” and “First steps” are a bit misleading.

---

<div class="post-metadata">

**Author:** ![masiddique](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/masiddique/32/5542_2.png) [@masiddique](https://discourse.julialang.org/u/masiddique)\
**Post date:** [October 1, 2018, 7:53am UTC](https://discourse.julialang.org/t/error-in-using-mat/14143/6 "2018-10-01T07:53:34Z")

</div>

Thanks @jaakkor2. I am eagerly waiting for the PRs to get merged in the master branch so I can start using MAT again.
