A module to allow Python to call functions from a compiled Matlab archive
Project description
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 MatlabmxArray
). 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
andcall_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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for libpymcr-0.1.8-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c663b64772d50c3570fcd5bceffc9274d6d02200946ff166253be5557c4808a |
|
MD5 | cf3730ebde1c2aa375d0041c221735c8 |
|
BLAKE2b-256 | 21d99a3424c9bc52ed9ecc69634af69547a7e01548a31184f252fb336dee61c8 |
Hashes for libpymcr-0.1.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b0b2f578e8891d363d3ccc1ad6953415f1fd4b108dd1bd44b6727c46cdc6a14 |
|
MD5 | c6b0a9ff34762df35156df686e021602 |
|
BLAKE2b-256 | 126f0d4c5cee2e3f0b07cc57cb24435a2a27d9a34ef5d4ed423da9923f625af7 |
Hashes for libpymcr-0.1.8-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8e4efacd63d82763c3419befb87763f5bce3cd7ddb14be098757347fbd512df |
|
MD5 | 8d4a1c68b369bfd93cba5a25c46d42f5 |
|
BLAKE2b-256 | 54f551e5add658f82dc4e0758ae96a5624233702311a07c28d440f940bf9a2ad |
Hashes for libpymcr-0.1.8-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fbf52c88fc170d70fdc68d6d73cbe0a0afc6040999b41223f3bcd6a916e0a88 |
|
MD5 | f05b82763e9eab223e8e0c1bb9cc8c9e |
|
BLAKE2b-256 | 3f934235b0d69d58a84277ce8dd11110fb3b1be33af694797857f4fd0a645142 |
Hashes for libpymcr-0.1.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cb5986e37dd14a3c0615a2eea5cf21477ec9ada622eb2558431bc97aa43144c |
|
MD5 | eff4d4917d6b75b5c77c1764858cc116 |
|
BLAKE2b-256 | 77f934561be8ca369e369258e76e293da48a101a25fa329de21db984d895493f |
Hashes for libpymcr-0.1.8-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a6f62cbc0d89ecee6403ecc15ab2c08559fab64f987b4c21b3d2bb5c3d7085b |
|
MD5 | 8cd1562b0ca43eb0faadbf92e071ae54 |
|
BLAKE2b-256 | 83ae0d2a2021dec8fbf04c1633a773333c1510dfc5d2bf2d6011d8d6124495e6 |
Hashes for libpymcr-0.1.8-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8028b4ae1b47d834f101bbb0ee5b9d500613aa11bf8f8c45fa637d288c6d5f7c |
|
MD5 | 1ceae72e76a3399dd70d3411ea0260d9 |
|
BLAKE2b-256 | 622f68a9722cff3f03d084521e64fc28ae7cf11fe4e48e5d579a5473fb6f36f2 |
Hashes for libpymcr-0.1.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c42f2b83bb1f92ae3b0841ce386ca2fc5e3742b480ae00a1d48a97459da1f50b |
|
MD5 | 78ede65985c764a1b382b4cfcdec55ed |
|
BLAKE2b-256 | 468126ae19cab02490c10cf5abbd72e74fa80587e76159b7bab96a7c21c74c0e |
Hashes for libpymcr-0.1.8-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e7b074b072ddbd6809c4d4c9ffb3528a215238a98610d903d389d2f04524303 |
|
MD5 | eb23e4b5fd5d319ae2a071cef82f885d |
|
BLAKE2b-256 | 785bbb8f326886d51b1143aef20b9e2aa1406736c84d74d601fa7daee8b78ebc |
Hashes for libpymcr-0.1.8-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23d9752593b4fcaa921745f437d1ec6d41819f2f225768d8de9042789294aeb3 |
|
MD5 | 89d6f8784d96ed02a1f8bc12108011ef |
|
BLAKE2b-256 | 182348add3b16e75ab9734f8a0361d7799d9c44b9ca61537e9450a463d654702 |
Hashes for libpymcr-0.1.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d43e332b014a918c9cf76bd9ec329e19557c1e6d3ce74862cbc4c18ab9ca865 |
|
MD5 | f3bc55c6d6364edf9d78fcaedd174813 |
|
BLAKE2b-256 | d04496483186071dc7e06ad9adb4b2b13c33bda5e082ea4f02739f476286b2fe |
Hashes for libpymcr-0.1.8-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b098315041ed957d76339ad70333ce93d73e8d12c21a546f3b88f749d2db5c97 |
|
MD5 | 3b9275a20d2715fd3e0db4a52bebc95b |
|
BLAKE2b-256 | 4af6d7bd09f0c55dd002b1f218989ae864a07d111e8a0208c8f0c6c23adeefb0 |
Hashes for libpymcr-0.1.8-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce464b10dae491c304b82a9d6645b8c3ee89d18e67a4751b9add32d66fb7b60f |
|
MD5 | a13324aa4dfd3dc7a1fb520dab8be829 |
|
BLAKE2b-256 | c29ec96305e8e8533c8a51689389e10bc7f375e875445d1cd416ab8189f06a73 |
Hashes for libpymcr-0.1.8-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0731a3dfb8cbb99406303c30b73fccabd2d5015630b405318a4d62c679b981b4 |
|
MD5 | f7cc1eb022bf2c2dcdf7902749904556 |
|
BLAKE2b-256 | a98de5d82f06b125c32b727536934f54404d3c9ffcbba1c90cd50459ee06c472 |
Hashes for libpymcr-0.1.8-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0f21b959d9118bc92ed824a280248be463cbde0c2cde61b746c54b0b3cdbe8e |
|
MD5 | 16267914a6b1957753aa34eb5292f6c9 |
|
BLAKE2b-256 | ce9533c8b7e77e262963c7c5be83c76caf370e20aa7f73eda1effe689869e7c8 |