Methods list

Methods usage

MAT.matopenFunction
matopen(filename [, mode]; compress = false) -> handle
matopen(f::Function, filename [, mode]; compress = false) -> f(handle)

Mode defaults to "r" for read. It can also be "w" for write, or "r+" for read or write without creation or truncation.

Compression on reading is detected/handled automatically; the compress keyword argument only affects write operations.

Use with read, write, close, keys, and haskey.

source
MAT.matreadMethod
matread(filename) -> Dict

Return a dictionary of all the variables and values in a Matlab file, opening and closing it automatically.

source
MAT.matwriteMethod
matwrite(filename, d::Dict; compress::Bool = false, version::String = "v7.3")

Write a dictionary containing variable names as keys and values as values to a Matlab file, opening and closing it automatically.

source
MAT.MAT_types.MatlabClassObjectType
MatlabClassObject(
    d::Dict{String, Any},
    class::String,
) <: AbstractDict{String, Any}

Type to store old class objects. Inside MATLAB a class named "TestClassOld" would be defined within @TestClassOld folders.

If you want to write these objects you have to make sure the keys in the Dict match the class defined properties/fields.

source
MAT.MAT_types.MatlabStructArrayType
MatlabStructArray{N}(
    names::Vector{String},
    values::Vector{Array{Any,N}},
    class::String = "",
)

Data structure to store matlab struct arrays, which stores the field names separate from the field values. The field values are stored as columns of Array{Any,N} per Matlab field, which is how MAT files store these structures.

These are distinct from cell arrays of structs, which are handled as in MAT.jl as Array{Any,N} with Dict{String,Any} inside, for example Any[Dict("x"=>1), Dict("x"=>2)].

Old class object arrays can be handled by providing a non-empty class name.

Example

using MAT

s_arr = MatlabStructArray(["a", "b"], [[1, 2],["foo", 5]])

# write-read
matwrite("matfile.mat", Dict("struct_array" => s_arr))
read_s_arr = matread("matfile.mat")["struct_array"]

# convert to Dict Array
dict_array = Array{Dict{String,Any}}(s_arr)

# convert to Dict (with arrays as fields)
dict = Dict{String,Any}(s_arr)
source