[SciPy-dev] [patch] read/write v5 .mat files with structs, cell arrays, objects, or function handles

Thouis (Ray) Jones thouis at broad.mit.edu
Wed Oct 1 11:52:21 EDT 2008


I just submitted a patch (http://scipy.org/scipy/scipy/ticket/743)
extending the functionality of io.matlab for v5 files, adding writers
for structs, cell arrays, & objects, and readers+writers for function
handles and 64-bit ints.

The patch modifies the numpy types of strings, structs, and objects
loaded from matlab:
matlab strings are loaded as numpy arrays of unicode strings, rather
than numpy arrays of objects.
structs are loaded as numpy arrays with dtype [(field_name, object), ...]
matlab objects are wrapped in an mio5.MatlabObject  instance, which
contains a 1x1 struct & the object classname.
(function handles are also wrapped in a special object in mio5.py)

These changes were to make the scipy<->matlab mapping more explicit.
The changes to the string type probably don't break any existing code.
 The changes to the struct & matlab objects probably do.  It's
possible to make both of these backward compatible, if that's a
priority.  We're looking for feedback on that (or any other) issue.

Ray Jones



More information about the SciPy-Dev mailing list