Skip to content

Commit

Permalink
Attempt reading old-style Matlab class in v7.3 as struct (JuliaIO#198)
Browse files Browse the repository at this point in the history
* Attempt reading old classes in v7.3 as struct

* Add test file
  • Loading branch information
Jeroen-van-der-Meer authored May 20, 2024
1 parent ab2e92a commit 4d33c78
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/MAT_HDF5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function m_read(g::HDF5.Group)
@warn "MATLAB $mattype values are currently not supported"
return missing
else
error("Cannot read from a non-struct group, type was $mattype")
@warn "Unknown non-struct group of type $mattype detected; attempting to read as struct"
end
end
if haskey(g, "MATLAB_fields")
Expand Down
7 changes: 7 additions & 0 deletions test/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,10 @@ let objtestfile = "struct_table_datetime.mat"
@test "testDatetime" in keys(vars)
@test ismissing(vars["testDatetime"])
end

# test reading of old-style Matlab object in v7.3 format
let objtestfile = "old_class.mat"
vars = matread(joinpath(dirname(@__FILE__), "v7.3", objtestfile))
@test "tc_old" in keys(vars)
@test "foo" in keys(vars["tc_old"])
end
Binary file added test/v7.3/old_class.mat
Binary file not shown.

0 comments on commit 4d33c78

Please sign in to comment.