pymodalib.utils.matlab module

is_matlab_array(value: Any) → bool

Returns whether a variable is a Matlab type.

matlab_to_numpy(data: Union[numpy.ndarray, Dict[KT, VT]]) → Union[numpy.ndarray, Dict[KT, VT]]

Converts a matlab array to a numpy array. Can be much faster than simply calling “np.asarray()”, for real arrays.

Parameters:data (array_like, Dict) – The MATLAB array to convert. If a dict, all values which are MATLAB arrays will be converted.
Returns:If an array was passed, returns an ndarray; otherwise, a dict whose values have been converted to ndarray if necessary.
Return type:ndarray, Dict
multi_matlab_to_numpy(*args) → List[numpy.ndarray]

Converts multiple matlab arrays to numpy arrays using matlab_to_numpy().

This allows code like the following:

x, y = multi_matlab_to_numpy(x, y)

Parameters:args (array_like) – The arrays to convert.
Returns:Ordered list containing the Numpy equivalent of each MATLAB array.
Return type:List[ndarray]