matlabengine


Namematlabengine JSON
Version 24.1.2 PyPI version JSON
download
home_pagehttps://github.com/mathworks/matlab-engine-for-python/
SummaryA module to call MATLAB from Python
upload_time2024-03-24 15:33:30
maintainerNone
docs_urlNone
authorMathWorks
requires_python<3.12,>=3.9
licenseLICENSE.txt, located in this repository
keywords matlab matlab engine for python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MATLAB Engine API for Python

The MATLAB&reg; Engine API for Python&reg; provides a package to integrate MATLAB functionality directly with a Python application, creating an interface to call functions from your MATLAB installation from Python code. 

---
## Requirements
### Required MathWorks Products
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
* MATLAB release R2024a

### Required 3rd Party Products
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
* Python 3.9, 3.10, or 3.11
    * Supported Python versions by MATLAB release can be found [here](https://www.mathworks.com/support/requirements/python-compatibility.html).

---

## Install

### Windows
MATLAB Engine API for Python can be installed directly from the Python Package Index.
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
```bash
$ python -m pip install matlabengine==24.1.2
```



### Linux&reg; 
Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, Linux installs MATLAB at:<br>
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
```/usr/local/MATLAB/R2024a```

When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable LD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).

```bash
# in .bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<matlabroot>/bin/glnxa64
```

```bash
# in .tcshrc
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:<matlabroot>/bin/glnxa64
```

MATLAB Engine API for Python can be installed directly from the Python Package Index.
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
```bash
$ python -m pip install matlabengine==24.1.2
```

### macOS
Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, macOS installs MATLAB at:<br>

<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
```/Applications/MATLAB_R2024a.app```

When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable DYLD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).

```bash
# in .bashrc
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:<matlabroot>/bin/maci64
```

```bash
# in .tcshrc
setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:<matlabroot>/bin/maci64
```

MATLAB Engine API for Python can be installed directly from the Python Package Index.
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
```bash
$ python -m pip install matlabengine==24.1.2
```

---

## Getting Started
* Start Python.
* Import the ```matlab.engine``` package into the Python session.
* Start a new MATLAB process by calling ```start_matlab```. The ```start_matlab``` function returns a Python object which enables you to pass data and call functions executed by MATLAB.

```python
>>> import matlab.engine
>>> eng = matlab.engine.start_matlab()
>>> eng.sqrt(4.0)
2.0
```

* Call either the ```exit``` or ```quit``` function to stop the engine. Exiting Python with an engine running stops the engine and its MATLAB processes.

```python
>>> eng.quit()
```

See [Start and Stop MATLAB Engine for Python](https://www.mathworks.com/help/matlab/matlab_external/start-the-matlab-engine-for-python.html) for advanced startup examples.

---

## Examples
You can call any MATLAB function directly and return the results to Python. 
```python
>>> eng.plus(2, 3)
5
>>> eng.isprime(37)
True
>>> eng.gcd(100.0, 80.0, nargout=3)
(20.0, 1.0, -1.0)
```
See [Call MATLAB Functions from Python](https://www.mathworks.com/help/matlab/matlab_external/call-matlab-functions-from-python.html) for more usage examples.

---

## Limitations
Limitations of the MATLAB Engine API for Python can be found [here](https://www.mathworks.com/help/matlab/matlab_external/limitations-to-the-matlab-engine-for-python.html).

---

## Troubleshooting
See [Troubleshoot MATLAB Errors in Python](https://www.mathworks.com/help/matlab/matlab_external/troubleshoot-matlab-errors-in-python.html) for troubleshooting assistance.

---

## License
The license is available in the LICENSE.txt file within this repository.

---

## Support
Technical issues or enhancement requests can be submitted [here](https://github.com/mathworks/matlab-engine-for-python/issues). 

---

Copyright &copy; 2022 MathWorks, Inc. All rights reserved.

Linux&reg; is the registered trademark of Linus Torvalds in the U.S. and other countries.

Mac OS is a trademark of Apple Inc., registered in the U.S. and other countries.

"Python" and the Python logos are trademarks or registered trademarks of the Python Software Foundation, used by MathWorks with permission from the Foundation.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mathworks/matlab-engine-for-python/",
    "name": "matlabengine",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.12,>=3.9",
    "maintainer_email": null,
    "keywords": "MATLAB, MATLAB Engine for Python",
    "author": "MathWorks",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/91/9e/b71369d05c4f77579bc035c0847f31f218837488ed56b001ee717a9adbc5/matlabengine-24.1.2.tar.gz",
    "platform": null,
    "description": "# MATLAB Engine API for Python\n\nThe MATLAB&reg; Engine API for Python&reg; provides a package to integrate MATLAB functionality directly with a Python application, creating an interface to call functions from your MATLAB installation from Python code. \n\n---\n## Requirements\n### Required MathWorks Products\n<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->\n* MATLAB release R2024a\n\n### Required 3rd Party Products\n<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->\n* Python 3.9, 3.10, or 3.11\n    * Supported Python versions by MATLAB release can be found [here](https://www.mathworks.com/support/requirements/python-compatibility.html).\n\n---\n\n## Install\n\n### Windows\nMATLAB Engine API for Python can be installed directly from the Python Package Index.\n<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->\n```bash\n$ python -m pip install matlabengine==24.1.2\n```\n\n\n\n### Linux&reg; \nPrior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, Linux installs MATLAB at:<br>\n<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->\n```/usr/local/MATLAB/R2024a```\n\nWhen MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable LD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).\n\n```bash\n# in .bashrc\nexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<matlabroot>/bin/glnxa64\n```\n\n```bash\n# in .tcshrc\nsetenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:<matlabroot>/bin/glnxa64\n```\n\nMATLAB Engine API for Python can be installed directly from the Python Package Index.\n<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->\n```bash\n$ python -m pip install matlabengine==24.1.2\n```\n\n### macOS\nPrior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, macOS installs MATLAB at:<br>\n\n<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->\n```/Applications/MATLAB_R2024a.app```\n\nWhen MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable DYLD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).\n\n```bash\n# in .bashrc\nexport DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:<matlabroot>/bin/maci64\n```\n\n```bash\n# in .tcshrc\nsetenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:<matlabroot>/bin/maci64\n```\n\nMATLAB Engine API for Python can be installed directly from the Python Package Index.\n<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->\n```bash\n$ python -m pip install matlabengine==24.1.2\n```\n\n---\n\n## Getting Started\n* Start Python.\n* Import the ```matlab.engine``` package into the Python session.\n* Start a new MATLAB process by calling ```start_matlab```. The ```start_matlab``` function returns a Python object which enables you to pass data and call functions executed by MATLAB.\n\n```python\n>>> import matlab.engine\n>>> eng = matlab.engine.start_matlab()\n>>> eng.sqrt(4.0)\n2.0\n```\n\n* Call either the ```exit``` or ```quit``` function to stop the engine. Exiting Python with an engine running stops the engine and its MATLAB processes.\n\n```python\n>>> eng.quit()\n```\n\nSee [Start and Stop MATLAB Engine for Python](https://www.mathworks.com/help/matlab/matlab_external/start-the-matlab-engine-for-python.html) for advanced startup examples.\n\n---\n\n## Examples\nYou can call any MATLAB function directly and return the results to Python. \n```python\n>>> eng.plus(2, 3)\n5\n>>> eng.isprime(37)\nTrue\n>>> eng.gcd(100.0, 80.0, nargout=3)\n(20.0, 1.0, -1.0)\n```\nSee [Call MATLAB Functions from Python](https://www.mathworks.com/help/matlab/matlab_external/call-matlab-functions-from-python.html) for more usage examples.\n\n---\n\n## Limitations\nLimitations of the MATLAB Engine API for Python can be found [here](https://www.mathworks.com/help/matlab/matlab_external/limitations-to-the-matlab-engine-for-python.html).\n\n---\n\n## Troubleshooting\nSee [Troubleshoot MATLAB Errors in Python](https://www.mathworks.com/help/matlab/matlab_external/troubleshoot-matlab-errors-in-python.html) for troubleshooting assistance.\n\n---\n\n## License\nThe license is available in the LICENSE.txt file within this repository.\n\n---\n\n## Support\nTechnical issues or enhancement requests can be submitted [here](https://github.com/mathworks/matlab-engine-for-python/issues). \n\n---\n\nCopyright &copy; 2022 MathWorks, Inc. All rights reserved.\n\nLinux&reg; is the registered trademark of Linus Torvalds in the U.S. and other countries.\n\nMac OS is a trademark of Apple Inc., registered in the U.S. and other countries.\n\n\"Python\" and the Python logos are trademarks or registered trademarks of the Python Software Foundation, used by MathWorks with permission from the Foundation.\n\n\n",
    "bugtrack_url": null,
    "license": "LICENSE.txt, located in this repository",
    "summary": "A module to call MATLAB from Python",
    "version": "24.1.2",
    "project_urls": {
        "Documentation": "https://www.mathworks.com/help/matlab/matlab-engine-for-python.html",
        "Homepage": "https://github.com/mathworks/matlab-engine-for-python/",
        "Source": "https://github.com/mathworks/matlab-engine-for-python",
        "Tracker": "https://github.com/mathworks/matlab-engine-for-python/issues"
    },
    "split_keywords": [
        "matlab",
        " matlab engine for python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "919eb71369d05c4f77579bc035c0847f31f218837488ed56b001ee717a9adbc5",
                "md5": "70f3038f0675794cad1302706e9290ab",
                "sha256": "dde548046dfc15a565acce9b24410fc0881769031b66d28f78463a1d09c67881"
            },
            "downloads": -1,
            "filename": "matlabengine-24.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "70f3038f0675794cad1302706e9290ab",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.12,>=3.9",
            "size": 18765,
            "upload_time": "2024-03-24T15:33:30",
            "upload_time_iso_8601": "2024-03-24T15:33:30.049652Z",
            "url": "https://files.pythonhosted.org/packages/91/9e/b71369d05c4f77579bc035c0847f31f218837488ed56b001ee717a9adbc5/matlabengine-24.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-24 15:33:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mathworks",
    "github_project": "matlab-engine-for-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "matlabengine"
}
        
Elapsed time: 0.21441s