Hello everybody,

I cannot use **MATLAB.jl** due to the error : >

ERROR: LoadError: UndefRefError: access to undefined reference

Would you tell me ow to fix this problem in Win10?

Best regards,

Hello everybody,

I cannot use **MATLAB.jl** due to the error : >

ERROR: LoadError: UndefRefError: access to undefined reference

Would you tell me ow to fix this problem in Win10?

Best regards,

Can you include the full error message (including the stacktrace). While it might not make sense to you, it will most likely be very helpful in the process of locating the error.

2 Likes

Hey, Now I send you all the infos.

```
Stacktrace:
[1] MatFile(::String, ::String) at C:\Users\david\.juliapro\JuliaPro_v1.2.0-1\packages\MATLAB\cVrxc\src\matfile.jl:8
[2] #write_matfile#10 at C:\Users\david\.juliapro\JuliaPro_v1.2.0-1\packages\MATLAB\cVrxc\src\matfile.jl:72 [inlined]
[3] (::getfield(MATLAB, Symbol("#kw##write_matfile")))(::NamedTuple{(:a, :b, :c, :d, :s, :ss),Tuple{Array{Int32,2},Array{Float64,1},Array{Array{Float64,1},1},Dict{String,Any},String,Array{S,1}}}, ::typeof(write_matfile), ::String) at .\none:0 [4] top-level scope at C:\Users\david\BEM\test.jl:10
in expression starting at C:\Users\david\BEM\test.jl:10
```

And what is the content of your file test.jl?

And which Matlab version do you use?

test.jl & **Matlab 2019a**

```
struct S
x::Float64
y::Bool
z::Vector{Float64}
end
write_matfile("test.mat";
a = Int32[1 2 3; 4 5 6],
b = [1.2, 3.4, 5.6, 7.8],
c = [[0.0, 1.0], [1.0, 2.0], [1.0, 2.0, 3.0]],
d = Dict("name"=>"MATLAB", "score"=>100.0),
s = "abcde",
ss = [S(1.0, true, [1., 2.]), S(2.0, false, [3., 4.])] )
```

As a work around, you can use the MAT.jl package to read/write Matlab files (doesn’t require a Matlab installation).

```
julia> struct S
x::Float64
y::Bool
z::Vector{Float64}
end
julia> using MAT
julia> matwrite("test.mat", Dict(
"a" => Int32[1 2 3; 4 5 6],
"b" => [1.2, 3.4, 5.6, 7.8],
"c" => [[0.0, 1.0], [1.0, 2.0], [1.0, 2.0, 3.0]],
"d" => Dict("name"=>"MATLAB", "score"=>100.0),
"s" => "abcde",
"ss" => [S(1.0, true, [1., 2.]), S(2.0, false, [3., 4.])] ))
```

I can read the resulting file in Matlab 2019a.

1 Like

Thanks!

I am not sure, is it the reason that I am using JuliaPro 1.2.0??

I’ve no idea, I don’t just JuliaPro - personally I use the regular Julia binaries.

Note that the MAT.jl and MATLAB.jl are quite distinct and achieve different things - the latter is for communication with a running Matlab instance whereas the former is purely for reading/writing Matlab files.

1 Like

thank you!

Can you post to the main MATLAB.jl repo?

Also have you ran `pkg>build MATLAB`

please check the error infos (build MATLAB is used.)

```
ERROR: LoadError: InitError: IOError: stat: invalid argument (EINVAL)
Stacktrace:
[1] stat(::String) at .\stat.jl:68
[2] isdir at .\stat.jl:309 [inlined]
[3] matlab_libpath at C:\Users\david\.juliapro\JuliaPro_v1.2.0-1\packages\MATLAB\cVrxc\src\mxbase.jl:46 [inlined]
[4] __init__() at C:\Users\david\.juliapro\JuliaPro_v1.2.0-1\packages\MATLAB\cVrxc\src\MATLAB.jl:72
[5] _include_from_serialized(::String, ::Array{Any,1}) at .\loading.jl:685
[6] _require_from_serialized(::String) at .\loading.jl:736
[7] _require(::Base.PkgId) at .\loading.jl:1023
[8] require(::Base.PkgId) at .\loading.jl:911
[9] require(::Module, ::Symbol) at .\loading.jl:906
[10] include at .\boot.jl:328 [inlined]
[11] include_relative(::Module, ::String) at .\loading.jl:1094
[12] include(::Module, ::String) at .\Base.jl:31
[13] include(::String) at .\client.jl:431
[14] top-level scope at none:5
during initialization of module MATLAB
in expression starting at C:\Users\david\.juliapro\JuliaPro_v1.2.0-1\packages\MATLAB\cVrxc\test\runtests.jl:1
ERROR: Package MATLAB errored during testing
```