Read JLD files in MATLAB

Dear all,
I was wondering if anyone has implementing something to read JLD files in MATLAB? Since these files are basically HDF5 files, this should be easy using the built-in HDF5 tools in MATLAB, but I’m having some trouble figuring out how to retrieve data contained in julia types.
Specifically, I have a type ‘spike_model’ which has members ‘template_model’, ‘ml_seq’, ‘ll’ and ‘y’. I would like to access the field ‘y’, which contains the data on which the model was trained, in Matlab so that it can be plotted.
In MATLAB, I tried this:

    fid = H5F.open('model_file.jld');
    dset_id = H5D.open(fid,'/spike_model');
    dd = H5D.read(dset_id)
    dd = 

    template_model_: [8x1 uint8]
            ml_seq_: [8x1 uint8]
                ll_: -3.3711e+12
                 y_: [8x1 uint8]
    dd.y_

    ans =

      68
      63
     100
       2
       0
       0
       0
       0

Using h5dump gives me this

h5dump -d /spike_model model_file.jld
HDF5 "model_file.jld" {
DATASET "/spike_model" {
   DATATYPE  "/_types/00000009"
   DATASPACE  SCALAR
   DATA {
   (0): {
         DATASET 1460380 /_refs/00000056 ,
         DATASET 1460676 /_refs/00000108 ,
         -3.37113e+12,
         DATASET 40124228 /_refs/00000109
      }
   }
}
}

My guess was that the 8 bytes Matlab returns for each member represent the address of the dataset, equivalent to what h5dump shows me, but I’m not sure how to proceed from here.
Though this is not exactly a julia question, I was hoping that someone might have come across this as part of an effort to increase interoperability with Matlab (which is what led me here). Of course, a simple solution is to just save everything in .mat files, but then I will lose julia type information.

Just want to point out the existence of https://github.com/JuliaIO/MAT.jl.

Hi,
I have used MAT.jl extensively for reading older .mat files in julia. It works great!

1 Like

MAT.jl is great! unfortunately it doesn’t support julia’s DateTime yet.