JuliaIO / MAT.jl

Julia module for reading MATLAB files
MIT License
278 stars 71 forks source link

empty julia Dict is not readable by matlab #115

Open bjarthur opened 5 years ago

bjarthur commented 5 years ago

julia> matwrite("emptydict.mat", Dict("emptydict"=>Dict()))

results in the following in matlab:

>> load('/Users/arthurb/emptydict.mat')
Error using load
Cannot read file /Users/arthurb/emptydict.mat.

matlab does have the concept of an empty struct:

>> struct([])

ans = 

  0×0 empty struct array with no fields.

non-empty Dicts work just fine:

julia> matwrite("notemptydict.mat",Dict("notemptydict"=>Dict("a"=>1)))
>> load('/Users/arthurb/notemptydict.mat')
>> notemptydict

notemptydict = 

  struct with fields:

    a: 1