Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

libpymcr

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libpymcr

A module to allow Python to call functions from a compiled Matlab archive

  • 0.1.8
  • PyPI
  • Socket score

Maintainers
1

libpymcr

libpymcr is a Python module for loading a compiled Matlab ctf archive and running functions within it in Python.

Whilst there is an official Mathworks binding for Python, libpymcr provides a few benefits over the official package:

  • It is compatible with versions of Python not supported by Matlab (e.g. 3.10, 3.11, 3.12). Moreover, the supported Python versions are not locked to the Matlab versions, unlike with the official packages.
  • When converting data between Matlab and Python it avoids data copies where ever possible by wrapping the underlying arrays in the target type (numpy or Matlab mxArray). In the official bindings, a data copy is required when converting data from Python to Matlab (inputs to functions).
  • It provides a simpler syntax, and if you include the provided call.m and call_python.mex files in your compiled package, you will also be able to access Matlab objects transparently in Python, and pass Python callables to Matlab to evaluate (e.g. in a fitting routine).

Getting started

You can install the package using:

pip install libpymcr

You must create a compiled Matlab archive (ctf file) of your program using the Matlab Compiler SDK toolbox, using the mcc command:

mcc -W CTF:your_program_name -U mfile1 mfile2 mfile3

Then in Python, you can load this and call the Matlab functions with:

import libpymcr
m = libpymcr.Matlab('your_program_name.ctf')
m.mfile1()

The functions, mfile1, mfile2 etc. are exposed to Python can can be called as methods of the Matlab() object.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc