Skip to content
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
3 changes: 3 additions & 0 deletions src/MAT_HDF5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ function m_read(g::HDF5Group)
data = str2eltype_matlab[mattype][]
end
return SparseMatrixCSC(convert(Int, HDF5.a_read(g, sparse_attr_matlab)), length(jc)-1, jc, ir, data)
elseif mattype == "function_handle"
@warn "MATLAB $mattype values are currently not supported"
return missing
else
error("Cannot read from a non-struct group, type was $mattype")
end
Expand Down
9 changes: 8 additions & 1 deletion test/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,16 @@ let objtestfile = "figure.fig"
@test vars["hgS_070000"]["type"] == "figure"
end

# test reading file containing Matlab table and datetime objects
# test reading file containing Matlab function handle, 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 = "function_handles.mat"
vars = matread(joinpath(dirname(@__FILE__), "v7.3", objtestfile))
@test "sin" in keys(vars)
@test ismissing(vars["sin"])
@test "anonymous" in keys(vars)
@test ismissing(vars["anonymous"])
end
let objtestfile = "struct_table_datetime.mat"
vars = matread(joinpath(dirname(@__FILE__), "v7.3", objtestfile))["s"]
@test "testTable" in keys(vars)
Expand Down
Binary file added test/v7.3/function_handles.mat
Binary file not shown.