Giter Club home page Giter Club logo

mat.jl's Introduction

MAT.jl

Build Status

docs-stable docs-dev

Read and write MATLAB files in Julia

This library can read MATLAB .mat files, both in the older v4/v5/v6/v7 format, as well as the newer v7.3 format.

Installation

This is installed using the standard tools of the package manager:

pkg> add MAT

where you get the pkg> prompt by hitting ] as the first character of the line. (Exit pkg mode by hitting backspace or Ctrl-C as the first character of the line.)

See also the requirements for the HDF5 module, used for "v7.3" files and for writing *.mat files.

Usage

To load the module:

using MAT

To read a single variable from a MAT file (compressed files are detected and handled automatically):

file = matopen("matfile.mat")
read(file, "varname") # note that this does NOT introduce a variable ``varname`` into scope
close(file)

To write a variable to a MAT file:

file = matopen("matfile.mat", "w")
write(file, "varname", variable)
close(file)

To read all variables from a MAT file as a Dict:

vars = matread("matfile.mat")

To write a Dict to a MAT file, using its keys as variable names. The compress argument is optional, and compression is off by default:

matwrite("matfile.mat", Dict(
	"myvar1" => 0,
	"myvar2" => 1
); compress = true)

To write in MATLAB v4 format:

matwrite("matfile.mat", Dict(
	"myvar1" => 0,
	"myvar2" => 1
);version="v4")

To get a list of variable names in a MAT file:

file = matopen("matfile.mat")
varnames = keys(file)
close(file)

To check for the presence of a variable name in a MAT file:

file = matopen("matfile.mat")
if haskey(file, "variable")
    # something
end
close(file)

Caveats

  • All files are written in MATLAB v7.3 format by default.
  • Writing in MATLAB v4 format is provided by the matwrite function with keyword argument.

Credits

The MAT_HDF5 module, which provides read/write support for MATLAB v7.3 files, was written primarily by Tim Holy. The MAT_v5 module, which provides read support for MATLAB v5/v6/v7 files, was written primarily by Simon Kornblith. The MAT_v4 module, which provides read and write support for MATLAB v4 files, was written primarily by Victor Saase.

mat.jl's People

Contributors

bjarthur avatar dawbarton avatar dependabot[bot] avatar github-actions[bot] avatar grero avatar jaakkor2 avatar jdlangs avatar jebej avatar jmert avatar johnnychen94 avatar jovisfilius avatar juliatagbot avatar karajan9 avatar lucasb-eyer avatar mforets avatar mkitti avatar musm avatar nhz2 avatar qnikil7 avatar radioflash avatar ranocha avatar rened avatar rofinn avatar sciencesam avatar simonster avatar sjkelly avatar tanmaykm avatar timholy avatar tkelman avatar yuyichao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mat.jl's Issues

32 bit Type Error in MAT_v5.jl

It would appear that div() was returning Int64 values in some cases which generates type errors on 32 bit machines. The below patch appears to resolve the issue as with its addition all tests pass (read.jl&write.jl).

diff --git a/src/MAT_v5.jl b/src/MAT_v5.jl
index d1a7938..a8d04f1 100644
--- a/src/MAT_v5.jl
+++ b/src/MAT_v5.jl
@@ -92,7 +92,7 @@ end
 
 function read_element{T}(f::IOStream, swap_bytes::Bool, ::Type{T})
     (dtype, nbytes, hbytes) = read_header(f, swap_bytes)
-    data = read_bswap(f, swap_bytes, T, div(nbytes, sizeof(T)))
+    data = read_bswap(f, swap_bytes, T, int(div(nbytes, sizeof(T))))
     skip_padding(f, nbytes, hbytes)
     data
 end
@@ -191,7 +191,7 @@ function read_string(f::IOStream, swap_bytes::Bool, dimensions::Vector{Int32})
         # Technically, if dtype == 3 or dtype == 4, this is ISO-8859-1 and not Unicode.
         # However, the first 256 Unicode code points are derived from ISO-8859-1, so UCS-2
         # is a superset of 2-byte ISO-8859-1.
-        chars = read_bswap(f, swap_bytes, Uint16, div(nbytes, 2))
+        chars = read_bswap(f, swap_bytes, Uint16, int(div(nbytes, 2)))
         if dimensions[1] == 1
             data = CharString(chars)
         else

Package build error

I received the following build error when I added the package today:

julia> Pkg.add("MAT")
INFO: Cloning cache of Blosc from git://github.com/stevengj/Blosc.jl.git
INFO: Cloning cache of HDF5 from git://github.com/timholy/HDF5.jl.git
INFO: Cloning cache of MAT from git://github.com/simonster/MAT.jl.git
INFO: Cloning cache of Zlib from git://github.com/dcjones/Zlib.jl.git
INFO: Installing Blosc v0.1.1
INFO: Installing HDF5 v0.4.11
INFO: Installing MAT v0.2.9
INFO: Installing Zlib v0.1.7
INFO: Building Blosc
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (77) error setting certificate verify locations:
  CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
================================[ ERROR: Blosc ]================================

failed process: Process(`curl -o c-blosc-1.5.0.tar.gz -L https://github.com/Blosc/c-blosc/archive/v1.5.0.tar.gz`, ProcessExited(77)) [77]
while loading /home/weijian/.julia/v0.3/Blosc/deps/build.jl, in expression starting on line 16

================================================================================
INFO: Building HDF5

================================[ BUILD ERRORS ]================================

WARNING: Blosc had build errors.

 - packages with build errors remain installed in /home/weijian/.julia/v0.3
 - build the package(s) and all dependencies with `Pkg.build("Blosc")`
 - build a single package by running its `deps/build.jl` script

================================================================================

I think the problem boils down to the package Blosc.
Could you let me know how I can resolve it?

Thanks

Weijian

Is there a way to write DateTime values to a MAT file please?

using MAT
matwrite("foo.mat", Dict("now" => now()))

results in

ERROR: This is the write function for CompositeKind, but the input doesn't fit
Stacktrace:
 [1] m_write at /home/reb/.julia/v0.6/MAT/src/MAT_HDF5.jl:514 [inlined]
 [2] write(::MAT.MAT_HDF5.MatlabHDF5File, ::String, ::DateTime) at /home/reb/.julia/v0.6/MAT/src/MAT_HDF5.jl:530
 [3] matwrite(::String, ::Dict{String,DateTime}) at /home/reb/.julia/v0.6/MAT/src/MAT.jl:156

updated CharString semantics for Julia 0.3

The CharString constructor semantics are likely to change in Julia 0.3 (see JuliaLang/julia#7016). However, it looks like there is an easy way to update MAT so that it is compatible with both Julia 0.2 and 0.3:

In particular, it looks like you missed a spot in 67f2c4f, and the code

       return bytestring(CharString(data))
    elseif ndims(data) == 2
        return datap = ByteString[rstrip(bytestring(CharString(reshape(data[i, :], size(data,2))))) for i = 1:size(data, 1)]

can be updated to just use utf8(data) and utf8(reshape(...)), respectively; the intermediate construction of a UTF32String (née CharString) is not necessary.

Support for 7.0 MAT files

Apart from the currently supported 5.0 and 7.3 file formats, there is a 7.0 format, which is also appears to be based on HDF5. See e.g. http://www.mathworks.com/help/matlab/import_export/mat-file-versions.html

I tried reading a 7.0 file (containing a structure with a matrix field) and that file could be read with the same low-level code as 7.3., i.e. the patch below seemed to work correctly:

diff --git a/src/MAT.jl b/src/MAT.jl
index 8858610..b1d5876 100644
--- a/src/MAT.jl
+++ b/src/MAT.jl
@@ -49,6 +49,7 @@ function matopen(filename::String, rd::Bool, wr::Bool, cr::Bool, tr::Bool, ff::B

     # Send to appropriate module
     magic == "MATLAB 7.3 MAT-file".data ? MAT_HDF5.matopen(filename, rd, wr, cr, tr, ff) :
+    magic == "MATLAB 7.0 MAT-file".data ? MAT_HDF5.matopen(filename, rd, wr, cr, tr, ff) :
     magic == "MATLAB 5.0 MAT-file".data ? MAT_v5.matopen(filename, rd, wr, cr, tr, ff) :
         error("\"$filename\" is not a MAT file, or is an unsupported (v4) MAT file")
 end

Load path

To run these, I had to edit MAT.jl. This shows the diff:

--- a/src/MAT.jl
+++ b/src/MAT.jl
@@ -22,8 +22,8 @@
 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-load("MAT/src/MAT_HDF5")
-load("MAT/src/MAT_v5")
+load("src/MAT_HDF5")
+load("src/MAT_v5")
 module MAT
 using MAT_HDF5, MAT_v5
 import Base.read, Base.write

I didn't commit this, because it would mess you up. I'm guessing your local repository is in a directory called "MAT", but for those of us who clone your repository, it's called "MAT.jl".

write vs. reshape on Julia 0.5.0_

Hi,

on 0.5.0-dev+4426 (Win64), writing a reshaped array does not work. See example below. Thanks for having a look at it. /Paul S

using MAT
C1 = reshape(1:40,5,8) + 0
C2 = reshape(1:40,5,8)

fh = matopen("MatFile1.mat","w") #works
write(fh,"C1",C1)
close(fh)

fh = matopen("MatFile2.mat","w") #crashes
write(fh,"C2",C2)
close(fh)

Tag new version

@simonster and @yuyichao ,

May you tag a new version of MAT.jl? Our COBRA.jl package is dependent on MAT.jl (great package by the way!), but in order to ensure the compatibility of COBRA.jl with julia v0.6, we need the latest fixes on master.

Thanks.

cc: @syarra

Precompiling fails in Julia 1.0

Precompiling fails in Julia 1.0:

`Precompiling MAT [23992714-dd62-5051-b70f-ba57cb901cac]

ERROR: LoadError: LoadError: syntax: extra token "MatlabHDF5File" after end of expression
Stacktrace:
[1] include at ./boot.jl:317 [inlined]
[2] include_relative(::Module, ::String) at ./loading.jl:1038
[3] include at ./sysimg.jl:29 [inlined]
[4] include(::String) at /root/.julia/dev/MAT/src/MAT.jl:27
[5] top-level scope at none:0
[6] include at ./boot.jl:317 [inlined]
[7] include_relative(::Module, ::String) at ./loading.jl:1038
[8] include(::Module, ::String) at ./sysimg.jl:29
[9] top-level scope at none:2
[10] eval at ./boot.jl:319 [inlined]
[11] eval(::Expr) at ./client.jl:389
[12] top-level scope at ./none:3
in expression starting at /root/.julia/dev/MAT/src/MAT_HDF5.jl:39
in expression starting at /root/.julia/dev/MAT/src/MAT.jl:31
ERROR: Failed to precompile MAT [23992714-dd62-5051-b70f-ba57cb901cac] to /root/.julia/compiled/v1.0/MAT/3FHIv.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] macro expansion at ./logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
[4] precompile(::Pkg.Types.Context) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:489
[5] do_precompile!(::Dict{Symbol,Any}, ::Array{String,1}, ::Dict{Symbol,Any}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:586
[6] #invokelatest#1(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Any, ::Any, ::Vararg{Any,N} where N) at ./essentials.jl:686
[7] invokelatest(::Any, ::Any, ::Vararg{Any,N} where N) at ./essentials.jl:685
[8] do_cmd!(::Pkg.REPLMode.PkgCommand, ::REPL.LineEditREPL) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:542
[9] #do_cmd#30(::Bool, ::Function, ::REPL.LineEditREPL, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:507
[10] do_cmd at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:503 [inlined]
[11] (::getfield(Pkg.REPLMode, Symbol("##41#44")){REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:842
[12] #invokelatest#1 at ./essentials.jl:686 [inlined]
[13] invokelatest at ./essentials.jl:685 [inlined]
[14] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/LineEdit.jl:2261
[15] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:1029
[16] run_repl(::REPL.AbstractREPL, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:191
[17] (::getfield(Base, Symbol("##720#722")){Bool,Bool,Bool,Bool})(::Module) at ./logging.jl:311 [18] #invokelatest#1 at ./essentials.jl:686 [inlined]
[19] invokelatest at ./essentials.jl:685 [inlined]
[20] macro expansion at ./logging.jl:308 [inlined]
[21] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:330
[22] exec_options(::Base.JLOptions) at ./client.jl:242
[23] _start() at ./client.jl:421`

Precompiling in Julia 0.7, yield the following deprecation warnings:

`Precompiling MAT
[ Info: Precompiling MAT [23992714-dd62-5051-b70f-ba57cb901cac]

┌ Warning: Deprecated syntax type at /root/.julia/dev/MAT/src/MAT_HDF5.jl:39.
│ Use mutable struct instead.
└ @ ~/.julia/dev/MAT/src/MAT_HDF5.jl:39
┌ Warning: Deprecated syntax type at /root/.julia/dev/MAT/src/MAT_HDF5.jl:535.
│ Use mutable struct instead.
└ @ ~/.julia/dev/MAT/src/MAT_HDF5.jl:535
┌ Warning: Deprecated syntax parametric method syntax read_complex{T}(dtype::HDF5Datatype, dset::HDF5Dataset, ::Type{Array{T}}) around /root/.julia/dev/MAT/src/MAT_HDF5.jl:119.
│ Use read_complex(dtype::HDF5Datatype, dset::HDF5Dataset, #unused#::Type{Array{T}}) where T instead.
└ @ ~/.julia/dev/MAT/src/MAT_HDF5.jl:119
┌ Warning: Deprecated syntax parametric method syntax m_writetypeattr{T}(dset, ::Type{Complex{T}}) around /root/.julia/dev/MAT/src/MAT_HDF5.jl:298.
│ Use m_writetypeattr(dset, #unused#::Type{Complex{T}}) where T instead.
└ @ ~/.julia/dev/MAT/src/MAT_HDF5.jl:298
┌ Warning: Deprecated syntax parametric method syntax m_writearray{T <: HDF5BitsOrBool}(parent::HDF5Parent, name::String, adata::Array{T}) around /root/.julia/dev/MAT/src/MAT_HDF5.jl:328.
│ Use m_writearray(parent::HDF5Parent, name::String, adata::Array{T}) where T <: HDF5BitsOrBool instead.
└ @ ~/.julia/dev/MAT/src/MAT_HDF5.jl:328
┌ Warning: Deprecated syntax parametric method syntax m_writearray{T <: HDF5BitsOrBool}(parent::HDF5Parent, name::String, adata::Array{Complex{T}}) around /root/.julia/dev/MAT/src/MAT_HDF5.jl:340.
│ Use m_writearray(parent::HDF5Parent, name::String, adata::Array{Complex{T}}) where T <: HDF5BitsOrBool instead.
└ @ ~/.julia/dev/MAT/src/MAT_HDF5.jl:340
┌ Warning: Deprecated syntax parametric method syntax m_write{T <: HDF5BitsOrBool}(mfile::MatlabHDF5File, parent::HDF5Parent, name::String, data::Union{T, Complex{T}, Array{T}, Array{Complex{T}}}) around /root/.julia/dev/MAT/src/MAT_HDF5.jl:362.
│ Use m_write(mfile::MatlabHDF5File, parent::HDF5Parent, name::String, data::Union{T, Complex{T}, Array{T}, Array{Complex{T}}}) where T <: HDF5BitsOrBool instead.
└ @ ~/.julia/dev/MAT/src/MAT_HDF5.jl:362
┌ Warning: Deprecated syntax parametric method syntax m_write{T}(mfile::MatlabHDF5File, parent::HDF5Parent, name::String, data::SparseMatrixCSC{T}) around /root/.julia/dev/MAT/src/MAT_HDF5.jl:376.
│ Use m_write(mfile::MatlabHDF5File, parent::HDF5Parent, name::String, data::SparseMatrixCSC{T}) where T instead.
└ @ ~/.julia/dev/MAT/src/MAT_HDF5.jl:376
WARNING: importing deprecated binding Base.SparseMatrixCSC into MAT_HDF5.
WARNING: Base.SparseMatrixCSC is deprecated, run using SparseArrays to load sparse array functionality
likely near /root/.julia/dev/MAT/src/MAT_HDF5.jl:375
┌ Warning: Deprecated syntax parametric method syntax m_write{T}(mfile::MatlabHDF5File, parent::HDF5Parent, name::String, data::Array{T}) around /root/.julia/dev/MAT/src/MAT_HDF5.jl:429.
│ Use m_write(mfile::MatlabHDF5File, parent::HDF5Parent, name::String, data::Array{T}) where T instead.
└ @ ~/.julia/dev/MAT/src/MAT_HDF5.jl:429
WARNING: importing deprecated binding Base.Associative into MAT_HDF5.
WARNING: Base.Associative is deprecated, use AbstractDict instead.
likely near /root/.julia/dev/MAT/src/MAT_HDF5.jl:508
┌ Warning: Deprecated syntax type at /root/.julia/dev/MAT/src/MAT_v5.jl:41.
│ Use mutable struct instead.
└ @ ~/.julia/dev/MAT/src/MAT_v5.jl:41
┌ Warning: Deprecated syntax parametric method syntax read_bswap{T}(f::IO, swap_bytes::Bool, ::Type{T}) around /root/.julia/dev/MAT/src/MAT_v5.jl:87.
│ Use read_bswap(f::IO, swap_bytes::Bool, #unused#::Type{T}) where T instead.
└ @ ~/.julia/dev/MAT/src/MAT_v5.jl:87
┌ Warning: Deprecated syntax parametric method syntax read_bswap{T}(f::IO, swap_bytes::Bool, ::Type{T}, dim::Union{Int, Tuple{Vararg{Int}}}) around /root/.julia/dev/MAT/src/MAT_v5.jl:90.
│ Use read_bswap(f::IO, swap_bytes::Bool, #unused#::Type{T}, dim::Union{Int, Tuple{Vararg{Int}}}) where T instead.
└ @ ~/.julia/dev/MAT/src/MAT_v5.jl:90
┌ Warning: Deprecated syntax parametric method syntax read_element{T}(f::IO, swap_bytes::Bool, ::Type{T}) around /root/.julia/dev/MAT/src/MAT_v5.jl:118.
│ Use read_element(f::IO, swap_bytes::Bool, #unused#::Type{T}) where T instead.
└ @ ~/.julia/dev/MAT/src/MAT_v5.jl:118
┌ Warning: Deprecated syntax parametric method syntax read_data{T}(f::IO, swap_bytes::Bool, ::Type{T}, dimensions::Vector{Int32}) around /root/.julia/dev/MAT/src/MAT_v5.jl:137.
│ Use read_data(f::IO, swap_bytes::Bool, #unused#::Type{T}, dimensions::Vector{Int32}) where T instead.
└ @ ~/.julia/dev/MAT/src/MAT_v5.jl:137
┌ Warning: Deprecated syntax parametric method syntax matwrite{S, T}(filename::AbstractString, dict::Associative{S, T}) around /root/.julia/dev/MAT/src/MAT.jl:147.
│ Use matwrite(filename::AbstractString, dict::Associative{S, T}) where {S, T} instead.
└ @ ~/.julia/dev/MAT/src/MAT.jl:147
WARNING: importing deprecated binding Base.Associative into MAT.
WARNING: Base.Associative is deprecated, use AbstractDict instead.
likely near /root/.julia/dev/MAT/src/MAT.jl:140
WARNING: Base.Associative is deprecated, use AbstractDict instead.
likely near /root/.julia/dev/MAT/src/MAT.jl:140`

[PkgEval] MAT may have a testing issue on Julia 0.4 (2014-09-29)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.4

  • On 2014-09-28 the testing status was Tests pass.
  • On 2014-09-29 the testing status changed to Tests fail, but package loads.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Tests fail, but package loads. means that PackageEvaluator found the tests for your package, executed them, and they didn't pass. However, trying to load your package with using worked.

This error on Julia 0.4 is possibly due to recently merged pull request JuliaLang/julia#8420.
This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("MAT")' log
INFO: Installing BinDeps v0.3.5
INFO: Installing HDF5 v0.4.2
INFO: Installing MAT v0.2.6
INFO: Installing SHA v0.0.3
INFO: Installing URIParser v0.0.3
INFO: Installing Zlib v0.1.7
INFO: Building HDF5
INFO: Package database updated

>>> 'using MAT' log
Julia Version 0.4.0-dev+842
Commit e5d8c1a (2014-09-29 06:50 UTC)
Platform Info:
  System: Linux (x86_64-unknown-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

>>> test log

ERROR: InexactError()
 in add! at /home/idunning/pkgtest/.julia/v0.4/MAT/src/MAT_HDF5.jl:175
 in m_write at /home/idunning/pkgtest/.julia/v0.4/MAT/src/MAT_HDF5.jl:345
 in write at /home/idunning/pkgtest/.julia/v0.4/MAT/src/MAT_HDF5.jl:480
 in matwrite at /home/idunning/pkgtest/.julia/v0.4/MAT/src/MAT.jl:100
 in test_write at /home/idunning/pkgtest/.julia/v0.4/MAT/test/write.jl:6
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in include at ./boot.jl:245
 in include_from_node1 at loading.jl:128
 in process_options at ./client.jl:285
 in _start at ./client.jl:354
 in _start_3B_3625 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so
while loading /home/idunning/pkgtest/.julia/v0.4/MAT/test/write.jl, in expression starting on line 71
while loading /home/idunning/pkgtest/.julia/v0.4/MAT/test/runtests.jl, in expression starting on line 2

INFO: Testing MAT
=================================[ ERROR: MAT ]=================================

failed process: Process(`/home/idunning/julia04/usr/bin/julia /home/idunning/pkgtest/.julia/v0.4/MAT/test/runtests.jl`, ProcessExited(1)) [1]

================================================================================
INFO: No packages to install, update or remove
ERROR: MAT had test errors
 in error at error.jl:21
 in test at pkg/entry.jl:719
 in anonymous at pkg/dir.jl:28
 in cd at ./file.jl:20
 in cd at pkg/dir.jl:28
 in test at pkg.jl:68
 in process_options at ./client.jl:213
 in _start at ./client.jl:354
 in _start_3B_3625 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so

>>> end of log

Loading sparse MAT files

Hi, I would like to read some MAT files which has a sparse matrix as a variable. It says that "Sparse matrices not currently supported."
It would be nice to have this feature.

thanks and regards,
Abhijith

Warning of deprecation

It is my first time using this package. It is very nice.

There is a deprecation warning when I use matwrite:

WARNING: has(d,k) is deprecated, use haskey(d,k) instead.
 in m_writearray at /Users/dhlin/.julia/MAT/src/MAT_HDF5.jl:231

Cannot read MAT v5 files with a struct in them

Hello,

The previous grad student had a bunch of .mat files (v5) that were saved with a custom matlab struct. I can open them up using Matlab on a colleagues computer, but I'm wondering if I can also do so with Julia.

When I load a simple v5 .mat file, I'm able to read variables without a problem. But when I load the .mat files with struct, and run this code:

file = matopen("mat_with_struct.mat", "r")
names(file)

I get this error:
ERROR: zlib error: incorrect header check (Z_DATA_ERROR)

The bottom of the stack trace is

[11] names(::MAT.MAT_v5.Matlabv5File) at /Users/jamwheel/.julia/v0.6/MAT/src/MAT_v5.jl:386

If I run matread("mat_with_struct.mat", "r") I get ERROR: EOFError: read end of file

Bounds error when reading a v5 mat file with function handle.

I got the following error when reading the Scan this file.

ERROR: BoundsError: attempt to access 15-element Array{Type{T},1}:                
 Union{}                                                                          
 Union{}                                                                          
 Union{}                                                                          
 Union{}                                                                          
 Union{}                                                                          
 Float64                                                                          
 Float32                                                                          
 Int8                                                                             
 UInt8                                                                            
 Int16                                                                            
 UInt16                                                                           
 Int32                                                                            
 UInt32                                                                           
 Int64                                                                            
 UInt64                                                                           
  at index [16]                                                                   
 in read_matrix(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Bool) at /usr/share/julia/site/v0.5/MAT/src/MAT_v5.jl:328                                                
 in read_struct(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Bool, ::Array{Int32,1}, ::Bool) at /usr/share/julia/site/v0.5/MAT/src/MAT_v5.jl:181                      
 in read_matrix(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Bool) at /usr/share/julia/site/v0.5/MAT/src/MAT_v5.jl:322                                                
 in read_matrix(::IOStream, ::Bool) at /usr/share/julia/site/v0.5/MAT/src/MAT_v5.jl:297
 in read(::MAT.MAT_v5.Matlabv5File, ::ASCIIString) at /usr/share/julia/site/v0.5/MAT/src/MAT_v5.jl:420
 in eval(::Module, ::Any) at ./boot.jl:267

The file was created by MATLAB R2014b on windows 7.

Trying to save variable throws: LoadError: This is the write function for CompositeKind, but the input doesn't fit

Hi! Trying to save a variable to a .MAT file with julia 0.4.2 throws:

ERROR: LoadError: This is the write function for CompositeKind, but the input doesn't fit
 in m_write at /home/argel/.julia/v0.4/MAT/src/MAT_HDF5.jl:485
 in write at /home/argel/.julia/v0.4/MAT/src/MAT_HDF5.jl:494
 [inlined code] from /media/argel/ARR_ECAIM/2016/Cortes_horizontales_Presion_mod2.jl:97
 in anonymous at no file:0
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:304
 in process_options at ./client.jl:280
 in _start at ./client.jl:378
while loading /media/argel/ARR_ECAIM/2016/Cortes_horizontales_Presion_mod2.jl, in expression starting on line 8

The variable is defined by
Alturas = 2000: 100:5000

And im trying to save it as:
filep = matopen(string(Ruta2,"P_4D_n_",archi,".mat"),"w");
write(filep,"Alturas",Alturas);
close(filep);

I believe is a bug.

I wish i could be of more help!

Cannot write complex matrices

Would it be possible to save complex matrices as well?

julia> y = complex(rand(5,5),rand(5,5))
5x5 Complex128 Array:
    0.647783+0.85824im  0.00916134+0.951223im  0.282909+0.0147227im   0.0586552+0.26651im  0.880246+0.789439im
  0.0642369+0.587805im    0.928508+0.337794im   0.910828+0.602694im   0.866889+0.451158im  0.876455+0.965597im
   0.288223+0.253479im    0.924115+0.837454im  0.0783773+0.900726im    0.59707+0.684809im  0.216177+0.352811im
 0.999205+0.00247775im    0.502037+0.681987im     0.48883+0.59233im  0.172648+0.0151089im  0.548206+0.786362im
    0.830459+0.88749im   0.979251+0.0932437im  0.345495+0.0189409im   0.998324+0.229752im  0.175204+0.531069im

julia> matwrite("/tmp/y.mat", { "y" => y })
This is the write function for CompositeKind, but the input doesn't fit
 in m_write at /home/viral/.julia/MAT/src/MAT_HDF5.jl:370
 in m_write at /home/viral/.julia/MAT/src/MAT_HDF5.jl:315
 in write at /home/viral/.julia/MAT/src/MAT_HDF5.jl:378
 in matwrite at /home/viral/.julia/MAT/src/MAT.jl:92

Test case for big endian support

MATLAB files can be either little endian or big endian. Currently, big endian support is untested because, on little endian platforms, there doesn't seem to be a way to make MATLAB save a big endian file. It should work, but it would be nice to have a test case.

Nested dictionaries are limited in size

I'm using a .mat file as a catalog to point to saved logs, and have found that the nested dictionary is limited in size.

Here's a minimal working example demonstrating the bug.

using MAT

UUID = 1

catalog_full_path = "sandbox.MAT"

d = Dict()
d["UUID"] = UUID
d["path_to_solve"] = Dict()
for solveID in 1:4093
    d["path_to_solve"]["s$solveID"] = "fake_solve_log_$solveID.mat"
end
matwrite(catalog_full_path, d)

Sample Error Message

HDF5-DIAG: Error detected in HDF5 (1.8.16) thread 140602060291136:
  #000: ../../../src/H5A.c line 259 in H5Acreate2(): unable to create attribute
    major: Attribute
    minor: Unable to initialize object
  #001: ../../../src/H5Aint.c line 275 in H5A_create(): unable to create attribute in object header
    major: Attribute
    minor: Unable to insert object
  #002: ../../../src/H5Oattribute.c line 347 in H5O_attr_create(): unable to create new attribute in header
    major: Attribute
    minor: Unable to insert object
  #003: ../../../src/H5Omessage.c line 224 in H5O_msg_append_real(): unable to create new message
    major: Object header
    minor: No space available for allocation
  #004: ../../../src/H5Omessage.c line 1945 in H5O_msg_alloc(): unable to allocate space for message
    major: Object header
    minor: Unable to initialize object
  #005: ../../../src/H5Oalloc.c line 1142 in H5O_alloc(): object header message is too large
    major: Object header
    minor: Unable to initialize object
HDF5-DIAG: Error detected in HDF5 (1.8.16) thread 140602060291136:
  #000: ../../../src/H5A.c line 817 in H5Aget_name(): not an attribute
    major: Invalid arguments to routine
    minor: Inappropriate type

I'm not sure whether this is an issue with MAT.jl or with the .mat file format, and I know that storing my solves directly in d can solve my problem. (I could also save my catalog in a different file format that is appends more efficiently).

Changing 4093 to 4092 shows the point at which the number of entries to the inner dictionary exceeds its capacity, the code runs fine with only 4092 objects.

Package outdated?

Considering that the last commit is over half a year ago, there are still some (at least for me) serious issues, AND considering that there is another Julia Package MATLAB.jl which seems better updated and covering exactly the same functionality (reading and writing matlab files + additional functionality): Is it save to say that this MAT.jl package is outdated?

I only don't know if the MATLAB package is able to read the proposed "v5/v6/v7 formats, as well as the newer v7.3 format". So I don't know if the other package will work for older mat files.
https://github.com/JuliaInterop/MATLAB.jl

If this should be the case, would it then make sense to remove this MAT.jl package from julia and the JuliaIO Organization, and instead focus the work in only one project? For me it would definitely make sense to join the two projects nevertheless.

Compat depwarns

WARNING: Compat.ASCIIString is deprecated, use String instead.

anyone tackling this yet? if not, i can.

write 1-length Float64[] results in scalar

is this by design? a 1-length Any[] results in a vector, but a 1-length Float64[] results in a scalar:

julia> fid=matopen("foo.mat","w")
MAT.MAT_HDF5.MatlabHDF5File(HDF5 data file: foo.mat,true,true,0)

julia> write(fid,"any",Any[7.])

julia> write(fid,"float64",Float64[7.])

julia> close(fid)

julia> d=matread("foo.mat")
Dict{ByteString,Any} with 2 entries:
  "any"     => Any[7.0]
  "float64" => 7.0

julia> typeof(d["any"])
Array{Any,1}

julia> typeof(d["float64"])
Float64

julia> typeof(Any[7.])
Array{Any,1}

julia> typeof(Float64[7.])
Array{Float64,1}

Char matrix support

Both MATLAB and Julia support charactor matrix, but saving charactor matrix using MAT.jl in Julia will trigger an error. Charactor matrix is still useful when data is large since it is much faster in reading/writing and need fewer memory in MATLAB. Would you please support saving charactor matrix in MAT.jl?

`file["varname"]` and `file[:varname]` interface?

I just found myself intuitively expecting that, probably because I'm used to it from scipy io and jsoncpp.

Would you want a PR for that, or is it too non-Julian? (Or is there a caveat which I'm not seeing?)

String encoding problem

When I save a Julia dictionary, the string entries come into Matlab as column vectors of type char instead of regular strings. I can use the Matlab transpose operator to turn them into strings. If I read back the .mat file I generated from Julia, the string representation also is changed to an array that I can fix using the join() function. I tried changing the encoding when I store the Dict entry using the utf8() and utf16() but those functions didn't fix the problem. Am I missing something simple about strings or is this a bug? [Using Julia 0.3.3 on Windows 7; MAT pkg 0.2.8; Matlab R2013b]

Sample code:
testDict = Dict{ASCIIString, Any}()
testDict["oneParm"] = 23.3 # transported to Matlab correctly
testDict["secondParm"] = "test string" # comes into Matlab as 11x1 char array
mF = matopen("d:/testStr.mat", "w")
write(mF, "testDict", testDict)
close(mF)

Possible 0.7 / 1.0 issues

Lots of warnings so it is a bit hard to parse these. Many are repeats but the chain seems to start with MAT.

WARNING: importing deprecated binding Base.Complex64 into MAT_HDF5.
WARNING: Base.Complex64 is deprecated, use ComplexF32 instead.
  likely near /Users/lewis/Dropbox/Online Coursework/ML Independent explorations/nn by hand/sample.jl:19
WARNING: importing deprecated binding Base.Complex128 into MAT_HDF5.
WARNING: Base.Complex128 is deprecated, use ComplexF64 instead.
        ... my stuff ....
WARNING: Base.Complex64 is deprecated, use ComplexF32 instead.
WARNING: Base.Complex128 is deprecated, use ComplexF64 instead.
WARNING: Base.SparseMatrixCSC is deprecated, run `using SparseArrays` to load sparse array functionality  (this occurs many times)
in read_sparse at /Users/lewis/.julia/packages/MAT/Pn0pR/src/MAT_v5.jl

And then, more:

Warning: `srand` is deprecated, use `Random.seed!` instead.
│   caller = #run_training#75(::Array{String,1}, ::String, ::Float64, ::Int64, ::Float64, ::String, ::Array{Float64,1}, ::Bool, ::Array{Float64,1}, ::String, ::String, ::Bool, ::String, ::Array{Float64,1}, ::Bool, ::typeof(Main.GeneralNN.run_training), ::String, ::Int64, ::Array{Int64,1}) at GeneralNN.jl:322
└ @ Main.GeneralNN ~/Dropbox/Online Coursework/ML Independent explorations/nn by hand/GeneralNN.jl:322
┌ Warning: `Array{T, 1}(m::Int) where T` is deprecated, use `Array{T, 1}(undef, m)` instead.
│   caller = matopen(::String, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at MAT.jl:56
└ @ MAT ~/.julia/packages/MAT/Pn0pR/src/MAT.jl:56
┌ Warning: `Array{T, 1}(m::Int) where T` is deprecated, use `Array{T, 1}(undef, m)` instead.
│   caller = matopen(::String, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at MAT.jl:79
└ @ MAT ~/.julia/packages/MAT/Pn0pR/src/MAT.jl:79
┌ Warning: `finalizer(o, f::Function)` is deprecated, use `finalizer(f, o)` instead.
│   caller = Type at MAT_HDF5.jl:48 [inlined]
└ @ Core ~/.julia/packages/MAT/Pn0pR/src/MAT_HDF5.jl:48

followed by lots of SparseMatrixCSC warnings:

WARNING: Base.SparseMatrixCSC is deprecated, run `using SparseArrays` to load sparse array functionality

I suspect this arises from this call to load .MAT files in my extract_data function:

function extract_data(matfname::String)
    # read the data
    df = matread(matfname)
                 .... more stuff
    return ...
end

Struct arrays

Does MAT.jl provide any support for saving/loading struct arrays?

Randomly occuring error on reading large MAT files

There is an error which occurs every time I try to read multiple large MAT files.
Strangely enough, the error occurs only from time to time, and once it appears I can't load any further files without restarting Julia. I am running the newest versions of all packages and the standard build of Julia 0.6.2 on Windows.

In the Atom IDE I see the following:

Error getting attribute type
h5a_get_type at HDF5.jl:2152 [inlined]
datatype(::HDF5.HDF5Attribute) at HDF5.jl:1125
read(::HDF5.HDF5Attribute, ::Type{String}) at HDF5.jl:1323
a_read(::HDF5.HDF5Dataset, ::String) at HDF5.jl:1229
m_read(::HDF5.HDF5Dataset) at MAT_HDF5.jl:153
m_read(::HDF5.HDF5Dataset) at MAT_HDF5.jl:163
m_read(::HDF5.HDF5Group) at MAT_HDF5.jl:239
read(::MAT.MAT_HDF5.MatlabHDF5File, ::String) at MAT_HDF5.jl:258
read(::MAT.MAT_HDF5.MatlabHDF5File) at datafile.jl:45
matread(::String) at MAT.jl:132
load_matlab(::String, ::String) at data_preparation.jl:93
macro expansion at load_matlab_traces_to_jld2.jl:59 [inlined]
anonymous at <missing>:?
include_string(::String, ::String) at loading.jl:522
include_string(::String, ::String, ::Int64) at eval.jl:30
include_string(::Module, ::String, ::String, ::Int64, ::Vararg{Int64,N} where N) at eval.jl:34
(::Atom.##102#107{String,Int64,String})() at eval.jl:82
withpath(::Atom.##102#107{String,Int64,String}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
hideprompt(::Atom.##101#106{String,Int64,String}) at repl.jl:67
macro expansion at eval.jl:80 [inlined]
(::Atom.##100#105{Dict{String,Any}})() at task.jl:80

And the console prints out

HDF5-DIAG: Error detected in HDF5 (1.8.13) thread 0:
  #000: /home/abuild/rpmbuild/BUILD/hdf5-1.8.13/src/H5A.c line 1302 in H5Aget_type(): unable to regi
ster datatype ID
    major: Object atom
    minor: Unable to register new atom
  #001: /home/abuild/rpmbuild/BUILD/hdf5-1.8.13/src/H5I.c line 895 in H5I_register(): can't insert I
D node into skip list
    major: Object atom
    minor: Unable to insert object
  #002: /home/abuild/rpmbuild/BUILD/hdf5-1.8.13/src/H5SL.c line 995 in H5SL_insert(): can't create n
ew skip list node
    major: Skip Lists
    minor: Unable to insert object
  #003: /home/abuild/rpmbuild/BUILD/hdf5-1.8.13/src/H5SL.c line 687 in H5SL_insert_common(): can't i
nsert duplicate key
    major: Skip Lists
    minor: Unable to insert object

Sparse matrix loading

I am loading a file that contains one dense vector and a sparse matrix. This is the exact output I get. It made me feel like something went wrong with the loading, but later on I realized that it had loaded just fine.

julia> M = matread("dif_speed.mat")
Dict{ASCIIString,Any} with 2 entries:
  "RHS" => [0.0…
  "M"   => …

Perhaps it can print the sizes of the various objects loaded, and the first few entries?

Int64 problem in 'matread'

I'm using julia version 0.4.0-dev+4219 and have just updated MAT by Pkg.update().
When loading file scsd8.mat with the matread("scsd8.mat") command the following error occurs:

julia> vars=matread("scsd8.mat")
ERROR: MethodError: `skip_padding` has no method matching skip_padding(::IOStream, ::Int32,   ::Int32)
Closest candidates are:
  skip_padding(::IO, ::Int64, ::Int32)
 in read_element at /home/fsobral/.julia/MAT/src/MAT_v5.jl:109
 in read_matrix at /home/fsobral/.julia/MAT/src/MAT_v5.jl:310
 in read at /home/fsobral/.julia/MAT/src/MAT_v5.jl:346
 in matread at /home/fsobral/.julia/MAT/src/MAT.jl:109

To solve this problem I've changed Int to Int64 in lines 98 and 101 of file MAT_v5.jl.

Incremental reading of complex matrix from MatlabHDF5File

I mentioned this problem in #30 and realized it should be a new issue. I would like to read in a complex matrix incrementally via

mat.plain["data"][:,:,1]

but get

ERROR: Dataset indexing (hyperslab) is available only for bits types

The eltype of the dataset is

HDF5.hdf5_to_julia_eltype(HDF5.datatype(d))

which I'm guessing how complex objects are saved. Now, I can read the entire dataset in via read but I'd like to be able to slice along a dimension, as shown above. Obviously this works for Real arrays, but not Complex types. Is it simple to update read_complex to read incrementally? I'm not very familiar with HDF5.

MAT level 4 support

We currently support only MAT level 5, but MAT level 4 shouldn't be too hard

Can't write a BitArray to a MAT file

Writing a BitArray doesn't work:

using MAT

A = trues(10,10)

matwrite("foo.mat", Dict("mask"=>A))

# ERROR: This is the write function for CompositeKind, but the input doesn't fit
# Stacktrace:
#  [1] m_write(::MAT.MAT_HDF5.MatlabHDF5File, ::HDF5.HDF5Group, ::String, ::Tuple{Int64,Int64}) at /home/reb/.julia/v0.6/MAT/src/MAT_HDF5.jl:514
#  [2] m_write(::MAT.MAT_HDF5.MatlabHDF5File, ::HDF5.HDF5File, ::String, ::Array{String,1}, ::Array{Any,1}) at /home/reb/.julia/v0.6/MAT/src/MAT_HDF5.jl:502
#  [3] m_write(::MAT.MAT_HDF5.MatlabHDF5File, ::HDF5.HDF5File, ::String, ::BitArray{2}) at /home/reb/.julia/v0.6/MAT/src/MAT_HDF5.jl:517
#  [4] write(::MAT.MAT_HDF5.MatlabHDF5File, ::String, ::BitArray{2}) at /home/reb/.julia/v0.6/MAT/src/MAT_HDF5.jl:530
#  [5] matwrite(::String, ::Dict{String,BitArray{2}}) at /home/reb/.julia/v0.6/MAT/src/MAT.jl:156

A workaround is to convert to an Array of Bool and this becomes a MATLAB logical array

matwrite("bar.mat", Dict("mask"=>convert(Array{Bool},A)))

It would be nice if the MAT.jl library handled this conversion automatically on write.

saving an array of strings

Currently if you write an array of ASCIIStrings to a mat file, on the matlab side it will appear as a cell array where each entry is a numeric vector. Could these be made proper matlab strings?

Read IOStream for use with S3

Is it possible to pass an IOBuffer to MAT.jl?

This would be useful when storing data on services such as Amazon S3 with AWS.jl.
I tried the following code, but it did not work.

using AWS
using AWS.S3
env = AWSEnv(); bkt = "???"

file = S3.get_object(env, bkt, "testfile.mat").obj
#IOBuffer(data=Uint8[...], readable=true, writable=true, seekable=true, append=false, size=1040, maxsize=Inf, ptr=1041, mark=-1)

vars = matread(file)
# ERROR: `matread` has no method matching matread(::IOBuffer)

[PkgEval] MAT may have a testing issue on Julia 0.4 (2014-10-08)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.4

  • On 2014-10-05 the testing status was Tests pass.
  • On 2014-10-08 the testing status changed to Tests fail, but package loads.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Tests fail, but package loads. means that PackageEvaluator found the tests for your package, executed them, and they didn't pass. However, trying to load your package with using worked.

Special message from @IainNZ: This change may be due to breaking changes to Dict in JuliaLang/julia#8521, or the removal of deprecated syntax in JuliaLang/julia#8607.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("MAT")' log

WARNING: deprecated syntax "(String=>String)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:146.
Use "Dict{String,String}()" instead.

WARNING: deprecated syntax "(String=>String)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:147.
Use "Dict{String,String}()" instead.

WARNING: deprecated syntax "(String=>String)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:148.
Use "Dict{String,String}()" instead.

WARNING: deprecated syntax "(String=>String)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:149.
Use "Dict{String,String}()" instead.

WARNING: deprecated syntax "(Symbol=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:224.
Use "Dict{Symbol,Any}()" instead.

WARNING: deprecated syntax "(Symbol=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:383.
Use "Dict{Symbol,Any}()" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:387.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "(Any=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:494.
Use "Dict{Any,Any}()" instead.

WARNING: deprecated syntax "(Any=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:555.
Use "Dict{Any,Any}()" instead.

WARNING: deprecated syntax "(Any=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:660.
Use "Dict{Any,Any}()" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/HDF5/deps/build.jl:23.
Use "Dict(a=>b, ...)" instead.
INFO: Installing BinDeps v0.3.5
INFO: Installing HDF5 v0.4.3
INFO: Installing MAT v0.2.7
INFO: Installing SHA v0.0.3
INFO: Installing URIParser v0.0.3
INFO: Installing Zlib v0.1.7
INFO: Building HDF5
INFO: Package database updated
INFO: METADATA is out-of-date a you may not have the latest version of MAT
INFO: Use `Pkg.update()` to get the latest versions of your packages

>>> 'using MAT' log

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/MAT/src/MAT_HDF5.jl:488.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/MAT/src/MAT_HDF5.jl:505.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/MAT/src/MAT_HDF5.jl:521.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/HDF5/src/plain.jl:223.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/HDF5/src/plain.jl:2078.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "(String=>Type)[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/HDF5/src/JLD.jl:699.
Use "Dict{String,Type}(a=>b, ...)" instead.
Julia Version 0.4.0-dev+998
Commit e24fac0 (2014-10-07 22:02 UTC)
Platform Info:
  System: Linux (x86_64-unknown-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

>>> test log

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/MAT/src/MAT_HDF5.jl:488.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/MAT/src/MAT_HDF5.jl:505.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/MAT/src/MAT_HDF5.jl:521.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/HDF5/src/plain.jl:223.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/HDF5/src/plain.jl:2078.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "(String=>Type)[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/HDF5/src/JLD.jl:699.
Use "Dict{String,Type}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/MAT/test/read.jl:51.
... truncated ...
WARNING: deprecated syntax "(ASCIIString=>Any)[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/MAT/test/read.jl:107.
Use "Dict{ASCIIString,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/MAT/test/read.jl:107.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "(ASCIIString=>Any)[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/MAT/test/read.jl:108.
Use "Dict{ASCIIString,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/MAT/test/read.jl:113.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/MAT/test/read.jl:124.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/MAT/test/read.jl:128.
Use "Dict{Any,Any}(a=>b, ...)" instead.

ERROR: `Dict{K,V}` has no method matching Dict{K,V}(::Array{Union(UTF8String,ASCIIString),1}, ::Array{Any,1})
 in read at /home/idunning/pkgtest/.julia/v0.4/HDF5/src/datafile.jl:47
 in matread at /home/idunning/pkgtest/.julia/v0.4/MAT/src/MAT.jl:82
 in check at /home/idunning/pkgtest/.julia/v0.4/MAT/test/read.jl:26
 in anonymous at no file:63
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in include at ./boot.jl:245
 in include_from_node1 at loading.jl:128
 in process_options at ./client.jl:293
 in _start at ./client.jl:362
 in _start_3B_3789 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so
while loading /home/idunning/pkgtest/.julia/v0.4/MAT/test/read.jl, in expression starting on line 47
while loading /home/idunning/pkgtest/.julia/v0.4/MAT/test/runtests.jl, in expression starting on line 1

INFO: Testing MAT
=================================[ ERROR: MAT ]=================================

failed process: Process(`/home/idunning/julia04/usr/bin/julia /home/idunning/pkgtest/.julia/v0.4/MAT/test/runtests.jl`, ProcessExited(1)) [1]

================================================================================
INFO: No packages to install, update or remove
ERROR: MAT had test errors
 in error at error.jl:21
 in test at pkg/entry.jl:719
 in anonymous at pkg/dir.jl:28
 in cd at ./file.jl:20
 in cd at pkg/dir.jl:28
 in test at pkg.jl:68
 in process_options at ./client.jl:221
 in _start at ./client.jl:362
 in _start_3B_3789 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so

>>> end of log

Missing HDF5 features for MAT files

Possibly since 27a022d, some HDF5 features no longer work on MAT files:

julia> using HDF5, MAT

julia> fid = matopen("array.mat")
MatlabHDF5File(HDF5 data file: array.mat,true,false,0)

julia> exists(fid, "a2x2")
ERROR: no method exists(MatlabHDF5File,ASCIIString)

julia> close(fid)

julia> fid = h5open("array.mat")
HDF5 data file: array.mat

julia> exists(fid, "a2x2")
true

julia> exists(fid, "a2x2blah")
false

julia> close(fid)

On another machine I reverted both HDF5 and MAT to a prior commit, and such features worked again. Not sure whether this is trivial or deep, so I thought I'd bring it up for discussion.

Memory leak issue

I seem to have a memory leak. The following steps should reproduce the problem.

Create a data structure in matlab via
testData = struct('asString', 'aaaa', 'asFloat64', 122, 'asAnotherFloat64', 22)
then save it:
save('D:\\testdata.mat', '-struct', 'testData')
then run the following code in julia:

using MAT

function thyTest()::Void

    for j::Int64 = 1 : 100000
        matfile = matopen("D:\\testdata.mat")

        m_open::String  = read(matfile, "asString")
        m_high::Float64 = read(matfile, "asFloat64")
        m_low::Float64  = read(matfile, "asAnotherFloat64")

        close(matfile)
    end

    return nothing
end

then run thyTest() and gc().
This leaves me with 3 Gb RAM usage by julia which can never be freed during its lifetime.

I'm running this under windows
julia version is 0.5
MAT version is 0.3.1

Write of BitArray of length 2+ returns "This is the write function for CompositeKind, but the input doesn't fit"

ERROR: This is the write function for CompositeKind, but the input doesn't fit
in m_write(::MAT.MAT_HDF5.MatlabHDF5File, ::HDF5.HDF5Group, ::String, ::Tuple{Int64}) at /home/xanfus/.julia/v0.5/MAT/src/MAT_HDF5.jl:487
in m_write(::MAT.MAT_HDF5.MatlabHDF5File, ::HDF5.HDF5File, ::String, ::Array{String,1}, ::Array{Any,1}) at /home/xanfus/.julia/v0.5/MAT/src/MAT_HDF5.jl:475
in m_write(::MAT.MAT_HDF5.MatlabHDF5File, ::HDF5.HDF5File, ::String, ::BitArray{1}) at /home/xanfus/.julia/v0.5/MAT/src/MAT_HDF5.jl:490
in write(::MAT.MAT_HDF5.MatlabHDF5File, ::String, ::BitArray{1}) at /home/xanfus/.julia/v0.5/MAT/src/MAT_HDF5.jl:496

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.