La traduction de cette page n'est pas à jour. Cliquez ici pour voir la dernière version en anglais.
Appeler MATLAB à partir de C
mxArray
Remarque
Les fonctions de l’API Engine pour C utilisent la structure de données MATLAB mxArray
définie dans C Matrix API. Pour écrire des applications avec les fonctionnalités du C++ moderne, consultez Appeler MATLAB à partir de C++.
Les applications Engine sont des programmes autonomes qui vous permettent d’appeler MATLAB depuis vos propres programmes C/C++ en utilisant MATLAB comme moteur de calcul. Pour créer une application Engine, appelez la fonction mex
.
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.
Engine API pour C
Engine | Type for MATLAB engine |
engOpen | Start MATLAB engine session |
engOpenSingleUse | Start MATLAB engine session for single, nonshared use |
engClose | Quit MATLAB engine session |
engEvalString | Evaluate expression in string |
engGetVariable | Copy variable from MATLAB engine workspace |
engPutVariable | Put variable into MATLAB engine workspace |
engGetVisible | Determine visibility of MATLAB engine session |
engSetVisible | Show or hide MATLAB engine session |
engOutputBuffer | Specify buffer for MATLAB output |
Rubriques
Écrire des applications Engine
- Create C Engine Applications Using mxArray
What to do to start building C engine applications. - MATLAB Engine APIs for C and Fortran
Call MATLAB from your own C and Fortran programs, using MATLAB as a computation engine. - Call MATLAB Functions from C Applications
Create a C engine applicationengdemo.c
. - Attach to Existing MATLAB Sessions
This example shows how to attach an engine program to a MATLAB session that is already running. - Callbacks in Applications
Design user interface callbacks to be evaluated in the context of the base workspace.
Créer et exécuter des applications Windows
- Set Run-Time Library Path on Windows Systems
At run time, tell the operating system where the API shared libraries are by setting thePath
environment variable. - Build Windows Engine Application
This example shows how to verify the build process on Windows® platforms using the C exampleengwindemo.c
. - Run Windows Engine Application
This example shows how to run the C example,engwindemo.c
, from the Windows system prompt. - Register MATLAB as a COM Server
Register MATLAB for every session, to ensure that the current version of MATLAB is the registered version.
Créer et exécuter des applications Mac
- Set Run-Time Library Path on macOS Systems
Tell the operating system where the API shared libraries are by setting theDYLD_LIBRARY_PATH
environment variable. - Build Engine Application on macOS
This example shows how to verify the build process on a macOS platform. - Run Engine Application on macOS
This example shows how to run the C exampleengdemo.c
from the macOS Terminal Window.
Créer et exécuter des applications Linux
- Set Run-Time Library Path on Linux Systems
Tell the operating system where the API shared libraries are by setting theLD_LIBRARY_PATH
environment variable. - Build Engine Application on Linux
This example shows how to verify the build process on a Linux® platform. - Run Engine Application on Linux
This example shows how to run the C exampleengdemo.c
from the Linux system prompt.
Créer des applications dans un environnement de développement intégré
- Build Engine Applications with IDE
Tips to configure your integrated development environment to build engine applications.
Résolution des problèmes
What to do when MATLAB engine does not run.
Debug MATLAB Function Called by C Engine
How to verify MATLAB functions used in engine applications.
Some MATLAB functions that interact with the user are not supported in engine applications.
MATLAB libraries are not thread-safe.