Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Numpy arrays are not supported in savemat #13

@LucaCerina

Description

@LucaCerina

As from issue's title. This simple code:

from mat4py import savemat
import numpy as np

data = np.ones((10,1))
savemat('./test.mat', {'data':data})

raises an error. The error arises from numpy arrays not being an instance of Sequence. For the purposes of the library, it doesn't seem that strict Sequence requirements are necessary, so checking for hasattr(array, '__len__') and hasattr(array, '__getitem__') or isinstance(array, Iterable) should be enough to parse simple 2d arrays. What do you think @jcbsv @tirkarthi?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions