MPython Core provides Python bindings for MATLAB projects, enabling seamless integration of MATLAB functionalities into Python workflows. This package is designed to facilitate the creation of bindings for MATLAB projects, allowing users to interact with MATLAB objects, functions, and arrays directly from Python.
- MATLAB Integration: Interact with MATLAB objects, functions, and arrays directly from Python.
- Custom Data Types: Includes Python representations of MATLAB data types such as
Cell
,Struct
,Array
, andSparseArray
. - Delayed Arrays: Support for delayed evaluation of MATLAB arrays.
- Sparse Matrix Support: Handles MATLAB sparse matrices using
scipy.sparse
(if available). - Object-Oriented Design: Provides a clean and extensible API for working with MATLAB projects.
To install MPython-Core, use pip:
pip install mpython-core
- Python 3.9 - 3.13
- MATLAB Runtime (if MATLAB is not installed)
- NumPy
- Optional: SciPy (for sparse matrix support)
from mpython import Cell, Struct, Array
# Create a MATLAB cell array
cell = Cell.from_any([[1, 2], [3, 4]])
# Create a MATLAB struct
struct = Struct(a=Array([1, 2, 3]), b="example")
# Access struct fields
print(struct.a)
print(struct["b"])
-
Clone the repository:
git clone https://github.com/MPython-Package-Factory/mpython-core.git cd mpython-core
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
To run the test suite:
pytest
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Submit a pull request with a clear description of your changes.
This project is licensed under the GNU General Public License v2 (GPLv2).
- Johan Medrano ([email protected])
- Yael Balbastre ([email protected])