Using Mien with Matlab

Mien has some support for interoperability with Matlab v 7.x. There are two features that provide Matlab support, the ability to read and write .mat files, and the ability to use system calls to matlab function as part of an AbstractModel block.

Mat file support

Mien supports a wide variety of file formats, including most of the features of Matlab v.7 .mat files. This support is provided by the module mien.parsers.matfile. This is a python/numpy module that doesn't rely on Mathworks MEX library calls. Python users should feel free to extract this module from MIEN and modify or reuse it as needed for providing mat file support in other programs.

Supported features of mat files include compression, structs, cell arrays, character arrays and basic arrays. The only common feature which I know is not supported are spares arrays, so you will need to call "full" and "sparse" from within Matlab before saving and after loading from Mien for now (and waste some disk space).

The matfile module provides some low level functions for reading and writing python hashes NDarrays to mat files, but most Mien users will interact with mat files by reading and writing nmpml Data elements to these files. This is what happens if you use Mien GUIs to read mat files.

Mien will always write Data elements to mat files as a particular type of matlab struct array. Data elements can be read from this format of struct, or from simple formats that contain a single 2D array. 2D arrays will be read as timeseries Data elements, using the longer dimension as the number of samples, and the shorter one as the number of columns, and using default values for header parameters (sampling rate of 1.0, start time of 0.0). This is sufficient for some simple uses, but for complex data it is helpful to have your Matlab functions save Mien-compatible structs. The layout of the struct objects is as follows:

System Calls

Working ...

 

Last edit: 05/29/09

Index