JuliaIO / MAT.jl

Julia module for reading MATLAB files
MIT License
280 stars 71 forks source link

Julia DateTime cannot be written in mat file #158

Open pablosaa opened 3 years ago

pablosaa commented 3 years ago

I got the following error by trying to store Julia's DateTime variables into a MAT file, is there any work around for the error described below?

julia> using MAT
julia> using Dates

julia> t = now()
julia> fmat = matopen("test.mat", "w")
MAT.MAT_HDF5.MatlabHDF5File(HDF5 data file: test.mat, true, true, 0, false)

julia> write(fmat, "T", t)
ERROR: This is the write function for CompositeKind, but the input doesn't fit
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] m_write(::MAT.MAT_HDF5.MatlabHDF5File, ::HDF5.HDF5File, ::String, ::DateTime) at /home/user/.julia/packages/MAT/2LFMT/src/MAT_HDF5.jl:529
 [3] write(::MAT.MAT_HDF5.MatlabHDF5File, ::String, ::DateTime) at /home/user/.julia/packages/MAT/2LFMT/src/MAT_HDF5.jl:545
 [4] top-level scope at REPL[291]:1