Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid error with MATLAB classes that we can't handle #129

Merged
merged 3 commits into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/MAT_HDF5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ function m_read(dset::HDF5Dataset)
end
end
return out
elseif !haskey(str2type_matlab,mattype)
@warn "MATLAB $mattype values are currently not supported"
return missing
end

# Regular arrays of values
Expand Down Expand Up @@ -272,7 +275,7 @@ Return a list of variables in an opened Matlab file.

See `matopen`.
"""
names(f::MatlabHDF5File) = filter!(x->x != "#refs#", names(f.plain))
names(f::MatlabHDF5File) = filter!(x -> x!="#refs#" && x!="#subsystem#", names(f.plain))

"""
exists(matfile_handle, varname) -> Bool
Expand Down
11 changes: 11 additions & 0 deletions test/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,14 @@ let objtestfile = "figure.fig"
@test vars["hgS_070000"]["handle"] == 1.0
@test vars["hgS_070000"]["type"] == "figure"
end

# test reading file containing Matlab table and datetime objects
# since we don't support these objects, just make sure that there are no errors
# reading the file and that the variables are there and replaced with `missing`
let objtestfile = "struct_table_datetime.mat"
vars = matread(joinpath(dirname(@__FILE__), "v7.3", objtestfile))["s"]
@test "testTable" in keys(vars)
@test ismissing(vars["testTable"])
@test "testDatetime" in keys(vars)
@test ismissing(vars["testDatetime"])
end
Binary file added test/v7.3/struct_table_datetime.mat
Binary file not shown.