Menu

Examples

Joakim Möller

Examples

Some examples of how to use pymatlab.

Running the tests in Linux

If you don't have the matlab executable in you path, add it to the path first.

$ export PATH=/opt/MATLAB/R2013a/bin:$PATH

Runt the tests.

$ python setup.py test

Get a variable from Matlab

import pymatlab
matlab_session = pymatlab.session_factory()
matlab_session.run('A = randn(4)')
a = matlab_session.getvalue('A')

Transfer a ndarray to MATLAB's workspace

import pymatlab
import numpy
matlab_session = pymatlab.session_factory()
a = numpy.random.randn(4,4)
matlab_session.putvalue('A',a)

Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.