Install Python(x,y) for Windows, Anaconda or Entought Canopy for Windows and MacOSX. Linux flavors provide numpy as e.g. RPM and Debian packages.The IPython package is also recommended. Both Python 2 and 3 are supported.
The minimal required packages are:
but it is recommended to use the ipython notebook:
which can all be installed on Ubuntu/Debian systems with:
- sudo apt-get install python-scipy ipython-notebook
% ipython notebook PyMatlab.ipynb
Then issue the command:
>>> from matlab import Matlabor, when using the standalone version:
>>> m = Matlab()
>>> m Matlab('ifit')
From there on, any iFit and Matlab expression can be executed
The main idea is that any call to iFit/Matlab should be prepended with 'm.' and use the set/get/eval methods.>>> a = m.eval("a=iData('filename')") # to import a data file
>>> a = m.eval("a=iData(peaks)") # as an example
>>> m.eval("plot(a)") # generate a Matlab plot
>>> m.eval("b = a/2")
>>> b=m.get("b.Signal") # get the signal as a Numpy Array
>>> ax = m.get("getaxis(b, 1:ndims(b))") # get all axes values, here 'x' and 'y' axes.
assigns name=value in the iFit/Matlab workspace.m.get('name')
retrieves the named variable from the iFit/Matlab workspace.m.eval("expression")
evaluates the expression/code in the iFit/Matlab workspace. The expression can contain control statements.