Skip to main content

MATLAB wrapper for Python

Project description

MATLAB wrapper for Python

Name:

matlab_wrapper

Author:

Marek Rudnicki

Email:

marekrud@gmail.com

URL:

https://github.com/mrkrd/matlab_wrapper

License:

GNU General Public License v3 or later (GPLv3+)

Description

matlab_wrapper allows you to use MATLAB in a convenient way in Python. You can call MATLAB functions and access workspace variables directly from your Python scripts and interactive shell. MATLAB session is started in the background and appears as a regular Python module.

matlab_wrapper talks to MATLAB engine library using ctypes, so you do not have to compile anything!

Numerical, logical, struct and cell arrays are supported.

Usage

Initialize:

import matlab_wrapper
matlab = matlab_wrapper.MatlabSession()

Low level:

matlab.put('a', 12.3)
matlab.eval('b = a * 2')
b = matlab.get('b')

Workspace:

s = matlab.workspace.sin([0.1, 0.2, 0.3])

sorted,idx = matlab.workspace.sort([3,1,2], nout=2)

matlab.workspace.a = 12.3
b = matlab.workspace.b

Requirements

  • Python (2.7)

  • Matlab (tested with 2013b)

  • Numpy (1.8)

Platforms

If you are using matlab_wrapper with MATLAB version and OS not listed below, please let us know and we will update the table.

OS [1]

MATLAB

Bits [2]

Status

GNU/Linux

2013a (8.1)

64

working (py.test OK)

GNU/Linux

2013b (8.2)

64

working (py.test OK)

GNU/Linux

2014a (8.3)

64

only double arrays working [3]

Windows

2014a (8.3)

64

working (py.test OK)

Installation

pip install matlab_wrapper

Issues and Bugs

https://github.com/mrkrd/matlab_wrapper/issues

Alternatives

(last updated on June 17, 2014)

  • pymatlab

    • pure Python, no compilation, using ctypes (good)

    • quite raw (ugly)

    • memory leaks (bad)

  • mlabwrap

    • cool interface, mlab.sin() (good)

    • needs compilation (bad)

    • not much development (bad)

  • mlab

    • similar interface to mlabwrap (good)

    • using raw pipes (hmm)

    • there is another very old package with the same name (ugly)

  • pymatbridge

    • actively developed (good)

    • client-server architecture with ZeroMQ and JSON, complex (ugly)

    • missing basic functions, there’s no put (bad)

    • nice ipython notebook support (good)

Note: There is a nice overview of the available packages at StackOverflow.

Acknowledgments

matlab_wrapper was forked from pymatlab.

Donations

If you find matlab_wrapper useful, please consider making a donation. It will be a great feedback and will further motivate me to improve this software. Thank you in advance.

  • Bitcoin address: 1KwZMQCWJW8VbcmHT2xeMc4wsAeZinLeGe

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

matlab_wrapper-0.8.tar.gz (23.4 kB view details)

Uploaded Source

File details

Details for the file matlab_wrapper-0.8.tar.gz.

File metadata

  • Download URL: matlab_wrapper-0.8.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for matlab_wrapper-0.8.tar.gz
Algorithm Hash digest
SHA256 e293681015eeffc71ae31a242e40a3e24bf583f65d274d4fe27dea1bb39e2309
MD5 01dde7260ae1639cf1cbca002f4c1f5a
BLAKE2b-256 321e6565ba76f916a80785161e9c1de71386b7e3b7d6fcdf6103b7c2f10c3f2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page