Skip to content

Commit 4d33c78

Browse files
Attempt reading old-style Matlab class in v7.3 as struct (#198)
* Attempt reading old classes in v7.3 as struct * Add test file
1 parent ab2e92a commit 4d33c78

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/MAT_HDF5.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ function m_read(g::HDF5.Group)
229229
@warn "MATLAB $mattype values are currently not supported"
230230
return missing
231231
else
232-
error("Cannot read from a non-struct group, type was $mattype")
232+
@warn "Unknown non-struct group of type $mattype detected; attempting to read as struct"
233233
end
234234
end
235235
if haskey(g, "MATLAB_fields")

test/read.jl

+7
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,10 @@ let objtestfile = "struct_table_datetime.mat"
230230
@test "testDatetime" in keys(vars)
231231
@test ismissing(vars["testDatetime"])
232232
end
233+
234+
# test reading of old-style Matlab object in v7.3 format
235+
let objtestfile = "old_class.mat"
236+
vars = matread(joinpath(dirname(@__FILE__), "v7.3", objtestfile))
237+
@test "tc_old" in keys(vars)
238+
@test "foo" in keys(vars["tc_old"])
239+
end

test/v7.3/old_class.mat

4.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)