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.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bda0b0e821b43cb9cababb1e6d335ed2db8e934d4bc73938791528bb870b1f49 |
|
MD5 | b00192b0b0e2306f3e0dd4d1577ca862 |
|
BLAKE2b-256 | a4131e61615944ff0acbb12fabfe76bd7cda86750161920613ffede08eaa5de4 |
Hashes for libpymcr-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26a6316ba281618dd48219b01a0afa620632c2df4e122376410d24657dd43603 |
|
MD5 | 366ea0fe707f2fdcff9de4e2a0e46cc1 |
|
BLAKE2b-256 | e21a3cc10e503884b4afaf762c4f3bd171058f5c9d6beeb475b3c3a72fea8d84 |
Hashes for libpymcr-0.1.1-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af44c6c342df20ec3c2191783e53473f8703a19d704df6e5140052eb02ddb234 |
|
MD5 | 4a5c2d46b4273526623f659afab13c52 |
|
BLAKE2b-256 | c2bfbc837633231281307db6e3730d59121f1429ab8cfb46aa2a8c0cdfd721f1 |
Hashes for libpymcr-0.1.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 124b68b88810b3a82857770276fc1b04e6dfb0dba743826bf738580c42d2ec83 |
|
MD5 | 0946a3e3d8c15be7c68eb5ee0f7fa844 |
|
BLAKE2b-256 | 25b587334e6a38c17cd807925e5f9d0b4ed2d64612b9037ec2fafc9774e397ff |
Hashes for libpymcr-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a25c918e2d455da3b756a64f7a498ccaa8b0787c3a8c0ada546d3d2524ce83d1 |
|
MD5 | f2cb97a1e5b5b39e42b8a356e58f2d1a |
|
BLAKE2b-256 | c35d82b7058d20cfa256735988bca28712884edaabe407826a5186c98806ac46 |
Hashes for libpymcr-0.1.1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c87a4576e4a839ccb65c61fcd7e83416739a02d8262a6c50f0e8dc8b78238afe |
|
MD5 | b335651b431b13ed339b7589aa34f184 |
|
BLAKE2b-256 | 962a21c865b164117fc20069e03b76e2cbe2dd41a1259bd0a89137a090fe652c |
Hashes for libpymcr-0.1.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5cc1cf48aab40aa5413d7001e1984f195c11209828d692f9b163db775419e7a |
|
MD5 | e2a2f6c767be172a4f4144c0e602ab56 |
|
BLAKE2b-256 | c305f8840d6942add8544d405659236b70094f99df0701bcbb23e7b96625c1aa |
Hashes for libpymcr-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63a9f64cd4d33cbf920aa02cba6367eff0606992d837979f995ea72e2470eafc |
|
MD5 | ca85a5d68ceac0f1c96ae3f55a369fa5 |
|
BLAKE2b-256 | bc09568c916a606ca25f9d0d7ceff83e7e6cbad73bb44c272089a3017836220b |
Hashes for libpymcr-0.1.1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 357b9049fda258ccaa1afa1e1154050969c9dbb7cdb827dd56f02b595c1f2777 |
|
MD5 | 03ff80b6aee0e8e900c37787328b0945 |
|
BLAKE2b-256 | 0c254b69ecd7c72ef42d2fa1a454f359a3a25831fc651c2d4d00b9b04885208c |
Hashes for libpymcr-0.1.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b430799e297ca8caa8b68c99b83c2cb29b0451d83657dc71af5ad31113fc33af |
|
MD5 | 9d801d76b023a4812446ea1205ac41b6 |
|
BLAKE2b-256 | 0a798e0ea352a5b46ef38474afce4dd5d9e11d9f88881bfcd296105e0b648add |
Hashes for libpymcr-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3127b1673fc73009ce2f91008ce8c735c40c2190017cedcf1f9b55715700f0b7 |
|
MD5 | a188d3a1cfbea54fed3b67308e6a9985 |
|
BLAKE2b-256 | 0a1cf27309db9a074601b5b06b7822d5bf024175fe001d7b332f4cc682bc6267 |
Hashes for libpymcr-0.1.1-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9bea8239f20037ef3a71dae272df55b88479e30dd11c80ee7c112cef79573b3 |
|
MD5 | ae8a950422017ea7ca12ca8c1244c707 |
|
BLAKE2b-256 | cc8c626bb52e26f904aa36ccf126af138994286949d7972b15b86d1062d6d669 |
Hashes for libpymcr-0.1.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09d80a19f164317d63c889162f7a112956acc44f57c4e995a3cbf25d6def653b |
|
MD5 | 222d9dd7cccd7a7e670b5b94e4b45eae |
|
BLAKE2b-256 | 3480d87961c62476f3488618bc6c2b6a6cc6d8d5bf77975e7434eece3a2c3f82 |
Hashes for libpymcr-0.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0660131f685bae7d3158ec09e993396c92e10cdf0583be819e92c33f619c50df |
|
MD5 | 5f0b41d38795efd84a825af1aa04e8bf |
|
BLAKE2b-256 | b4c0da87b7682c689eccb0aa93edf94d88f35a15d0b8be4cfa56e3fddc9ff830 |
Hashes for libpymcr-0.1.1-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | caa4f5ac8f632c8edac63269ffb22c4013badf88e1c73349117f2b4ba42f7505 |
|
MD5 | 657ff5741a078305863c1b527b07adf2 |
|
BLAKE2b-256 | dbc60d091ff16f2c497372e86e47af702e1a191580c702e9e465991699a6bcf0 |