Skip to content

Matlab array wrapper

linc_convert.utils.io.matlab_array_wrapper

Utilities for reading HDF5 and MATLAB .mat files, and wrapping arrays.

ArrayWrapper

Abstract base class for array wrappers.

H5ArrayWrapper

H5ArrayWrapper(file, key)

Bases: ArrayWrapper

Wrapper for arrays stored in HDF5 files.

shape property

shape

Get shape of the array.

dtype property

dtype

Get data type of the array.

__del__

__del__()

Close the file if it is still open.

load

load()

Load the array from the HDF5 file.

__len__

__len__()

Get length of the first dimension.

__getitem__

__getitem__(index)

Get item by index.

MatArraywrapper

MatArraywrapper(file, key)

Bases: ArrayWrapper

Wrapper for arrays stored in old-style MATLAB .mat files.

shape property

shape

Get shape of the array, loading the array if necessary.

dtype property

dtype

Get data type of the array, loading the array if necessary.

__del__

__del__()

Close the file if it is still open.

load

load()

Load the array from the .mat file.

__len__

__len__()

Get length of the first dimension, loading the array if necessary.

__getitem__

__getitem__(index)

Get item by index, loading the array if necessary.