MAT.jl
MAT.jl copied to clipboard
MAT.jl can't find 'MATLAB_class'
I get the following error when I use matread from the MAT.jl package.
HDF5-DIAG: Error detected in HDF5 (1.10.4) thread 0:
#000: H5A.c line 425 in H5Aopen(): unable to load attribute info from object header for attribute: 'MATLAB_class'
major: Attribute
minor: Can't open object
#001: H5Aint.c line 478 in H5A__open(): unable to load attribute info from object header for attribute: 'MATLAB_class'
major: Attribute
minor: Can't open object
#002: H5Oattribute.c line 515 in H5O__attr_open_by_name(): can't locate attribute: 'MATLAB_class'
major: Attribute
minor: Object not found
ERROR: Error opening attribute /#subsystem#/MATLAB_class
Stacktrace:
[1] error(::String, ::String, ::String, ::String) at ./error.jl:42
[2] h5a_open at /Users/Zach/.julia/packages/HDF5/Zh9on/src/HDF5.jl:2279 [inlined]
[3] a_open(::HDF5.HDF5Group, ::String) at /Users/Zach/.julia/packages/HDF5/Zh9on/src/HDF5.jl:852
[4] a_read(::HDF5.HDF5Group, ::String) at /Users/Zach/.julia/packages/HDF5/Zh9on/src/HDF5.jl:1269
[5] m_read(::HDF5.HDF5Group) at /Users/Zach/.julia/packages/MAT/mPSjZ/src/MAT_HDF5.jl:198
[6] read(::MAT.MAT_HDF5.MatlabHDF5File, ::String) at /Users/Zach/.julia/packages/MAT/mPSjZ/src/MAT_HDF5.jl:261
[7] read(::MAT.MAT_HDF5.MatlabHDF5File) at /Users/Zach/.julia/packages/HDF5/Zh9on/src/datafile.jl:45
[8] matread(::String) at /Users/Zach/.julia/packages/MAT/mPSjZ/src/MAT.jl:133
[9] top-level scope at REPL[6]:1
The errors from HDF5 are pretty clear but I don't know why this is an issue with the file I have because it's doesn't seem to be improperly formatted. I was able to get it to load in Matlab fine and followed the instructions here to ensure that I have a supported file type. Which produce 'MATLAB 7.3 MAT-file, Platform: GLNXA64, Created on: Thu Aug 15 10:14:40 2019 HDF5 schema 1.00 . .
Update: I've gone back through and tried to figure out what's wrong. For some reason a mat file with these variables loads fine:
- all_id : 1065x1 double
- loaded_bd_network : 68x68x1065 logical
- loaded_tensor : 4-D double
- mode3 : 1x20 cell
But these variables error:
- all_id : 1997x1 string
- loaded_bd_network : 68x68x1997 logical
- loaded_tensor : 4-D double
- mode3 : 1x8 cell
I also have this problem. I did some trials and the error appears only for -v7.3 format, when I have a datetime object inside.
I'm also in the same situation. Though there are no datetime objects in my mat files.
It may be worth mentioning that any file I've encountered this error with here also doesn't open in anything but Matlab. In other words, I can't open it in Python or R.
Hmm, strange, I've managed to open them in python3 using h5py. I'll dig into it on the weekend. I'll make some test files and try and spot the difference.
Could you try with the branch from this PR to see if you can load the file? It won't make any unsupported types work, but at least the rest of the file will be readable.
In julia:
]add https://github.com/jebej/MAT.jl.git#patch-1