MAT.jl or HDF5.jl?



It’s not obvious which of these one should reach for first. I imagine the answer may be “it depends” but supposing you just have a .mat file drop in your lap what do you try first?


Answering myself (sort of): MAT.jl worked on the file I’m working with currently, FWIW. Ideally for my current use case I’d like to have similar behavior to MATLAB’s load command, i.e. create/update variables in the workspace. I found that something like the following seems to do that:

using MAT
data = matread(fname)
for k in keys(data)
    eval(parse("$k = data[\"$k\"]"))

I expect there’s a smarter way to do this so it can be put in a function, is safer, etc. Anyhow I’m guessing this is a common use case and someone has a better way.



FWIW, I would ingest the data in whatever format it is provided in, and from that point on use


If I understand correctly, the OP wants to load a .mat file: she is not asking for saving data.