Appeler MATLAB à partir de C++
L’API de MATLAB Engine pour C++ propose une interface entre le langage de programmation C++ et MATLAB. Elle permet aux programmes C++ de lancer MATLAB, d’évaluer les fonctions MATLAB avec des arguments et d’échanger des données entre MATLAB et des programmes C++. Les opérations supportées sont les suivantes :
Démarrer MATLAB.
Se connecter à une session MATLAB partagée sur la machine locale.
Appeler des fonctions MATLAB avec des arguments en entrée provenant de C++ et des variables en sortie renvoyées par MATLAB.
Évaluer des instructions MATLAB dans l’espace de travail de base de MATLAB.
Passer des variables de C++ vers MATLAB et de MATLAB vers C++.
Pour en savoir plus, consultez Set Up C++ Development Environment.
L’API de MATLAB Engine pour C++ utilise MATLAB Data API pour C++ qui permet aux applications s’exécutant en dehors de MATLAB de travailler avec des données MATLAB via une interface indépendante du langage. L’API Engine propose également une interface fortement typée qui applique un mapping strict des types de données entre MATLAB et C++. Vous pouvez vous en servir pour appeler des fonctions et des classes MATLAB par leur nom MATLAB en C++ comme si c’étaient des fonctions et classes C++ natives. Pour obtenir un exemple, consultez Integrate Strongly Typed MATLAB Data in C++ Application.
Classes
Fonctions
Rubriques
Configuration requise
- Requirements to Build C++ Engine Applications
Install and configure a compiler and run-time environment so you can build C++ applications to call MATLAB. - Set Up C++ Development Environment
Set up a development environment to write C++ applications that call MATLAB functions.
Intégrer du code MATLAB dans C++
- Structure of C++ Engine Applications
Get started with the MATLAB Engine API for C++. - Integrate MATLAB Function in C++ Application
Create a C++ engine application using the MATLAB Engine and Data APIs. - Integrate Strongly Typed MATLAB Data in C++ Application
Use strongly typed data with the MATLAB Engine API for C++.
Démarrer et se connecter à MATLAB
- Start MATLAB Sessions from C++
How to start and connect to a MATLAB session synchronously or asynchronously from C++. - Connect C++ to Running MATLAB Session
How to connect a C++ application to a MATLAB session that was started as or converted to a shared session.
Appeler des fonctions MATLAB
- Call MATLAB Functions from C++
How to call MATLAB functions from C++, passing variables to MATLAB and returning variables to C++. - Evaluate MATLAB Statements from C++
How to evaluate MATLAB statements in your C++ program, and write variables to the MATLAB base workspace. - Pass Variables from C++ to MATLAB
How to pass variables from C++ to MATLAB as function arguments or by placing those variables directly into the MATLAB base workspace. - Pass Variables from MATLAB to C++
How to get variables from the MATLAB base or global workspace. - Redirect MATLAB Command Window Output to C++
How to redirect MATLAB Command Window output, including error messages, to your C++ program. - Convert C++ Engine Application to MATLAB Compiler SDK Application
Convert an engine application to a deployed application using MATLAB Compiler SDK™.
Utiliser des types de données MATLAB dans C++
- Data Type Mappings Between C++ and Strongly Typed MATLAB Code
Refer to data type mappings between C++ and MATLAB when using strongly typed MATLAB code. - Create Structure Arrays from C++
How to create structure arrays in C++ and pass them to MATLAB, or retrieve structure arrays from MATLAB. - Create Cell Arrays from C++
How to create heterogeneous arrays in C++ to use as MATLAB cell arrays. - Pass Enumerations to MATLAB from C++
How to pass members of a MATLAB enumeration class to MATLAB from C++. - Pass Sparse Arrays to MATLAB from C++
How to pass arrays from C++ to MATLAB as MATLAB sparse arrays. - Use MATLAB Handle Classes in C++
Integrate MATLAB handle classes with C++ applications. - Limitations of Strongly Typed Interface for C++
Strongly typed interface for C++ features not supported in MATLAB.