Contenu principal

Appeler MATLAB à partir de Python

Écrire des programmes Python® qui fonctionnent avec MATLAB®

MATLAB Engine API pour Python propose un package pour que Python appelle MATLAB en tant que moteur de calcul. Le moteur supporte l’implémentation de référence (CPython). Pour plus d’informations sur les versions supportées, consultez Versions of Python Compatible with MATLAB Products by Release (Versions de Python compatibles avec les produits MATLAB par version).

Les applications Engine nécessitent une version installée de MATLAB. Vous ne pouvez pas exécuter MATLAB Engine sur un ordinateur seulement équipé de MATLAB Runtime.

Fonctions

développer tout

matlab.engine.start_matlabStart MATLAB Engine for Python
matlab.engine.find_matlabFind shared MATLAB sessions to connect to MATLAB Engine for Python
matlab.engine.connect_matlabConnect shared MATLAB session to MATLAB Engine for Python
matlab.engine.shareEngineConvert running MATLAB session to shared session
matlab.engine.engineNameReturn name of shared MATLAB session
matlab.engine.isEngineSharedDetermine if MATLAB session is shared

Classes

développer tout

matlab.engine.MatlabEnginePython object using MATLAB as computational engine within Python session
matlab.engine.FutureResultResults of asynchronous call to MATLAB function stored in Python object

Rubriques

Installation

  • Install MATLAB Engine API for Python
    MATLAB Engine API for Python allows you to call MATLAB functions and execute MATLAB commands from within a Python environment. To use the MATLAB engine, you must have a supported version of Python installed on your machine, and you must install MATLAB Engine API for Python as a Python package.

Pour commencer

Gestion des sessions

Utiliser l’espace de travail MATLAB

Échange et mapping de données

Appeler des fonctions MATLAB

Résolution des problèmes

Limitations to MATLAB Engine API for Python

MATLAB Engine API for Python does not support these features.

Troubleshoot MATLAB Errors in Python

When a MATLAB function raises an error, the MATLAB Engine for Python stops the function and catches the exception raised by MATLAB.