matlab- Matlab bindings and interface

Safe HaskellNone




Mapping of basic Matlab types to Haskell types.


Representations of Matlab types

Most types are simple aliases of Haskell types, given simply to identify them and provide a consistent naming scheme.

type MIO a = IO a Source

class MScalar a Source

The class of types which are simple Matlab scalars and can be array elements

class (MScalar a, Num a) => MNumeric a Source

The class of types which Matlab consisters "numeric"

Numeric types

type MComplex = Complex Source

Complex numeric types. Unfortunately, Complex only applies to RealFloat types, whereas Matlab allows any numeric type, so some types are (currently) unaccessable.

Array indexing

type MSize = [Int] Source

The type of array sizes, which are the column-major lengths of each dimensions

type MSubs = [Int] Source

The type of array index subscripts, which are the column-major, 0-based indices in each dimension with normal Matlab semantics (flatten along last dimension)

newtype MIndex Source

Ways to index an array. Using Matlab semantics, a singleton MSubs [n] is equivalent to a raw 0-based offset (MOffset n).


MSubs MSubs 

mStart :: MIndex Source

First index in array

mOffset :: Int -> MIndex Source

Raw, 0-based array offset index

mSizeRange :: MSize -> (MIndex, MIndex) Source

Convert an array size to an index range, which will be of the form ((0,0,0...),(i-1,j-1,k-1,...))

mRangeSize :: (MIndex, MIndex) -> MSize Source

Convert an index range to an array size

normMSize :: MSize -> MSize Source

Get a more useful size form (no trailing singletons)

realMSize :: MSize -> MSize Source

Get the size form that Matlab likes (length (realMSize s) >= 2)

Opaque types

data MXArray a Source

The general Matlab Array type, used for most all Matlab data

type MAnyArray = MXArray MAny Source

A generic, untyped (void) array, which must be cast (using castMXArray)

newtype MCell Source

A wrapper for a member of a cell array, which itself simply any other array




mCell :: MAnyArray

data MStruct Source

A single struct in an array, represented by an (ordered) list of key-value pairs

type MFun Source


 = [MAnyArray]

RHS input arguments

-> Int

LHS output argument count

-> IO [MAnyArray]

LHS output arguments

A Matlab function