Llamar a MATLAB desde C
mxArray
Nota
Las funciones de la API del motor para C funcionan con la estructura de datos mxArray de MATLAB, que se define en API para manipular matrices en C. Para escribir aplicaciones con funcionalidades de C++ moderno, consulte Llamar a MATLAB desde C++.
Las aplicaciones de del motor son programas independientes que le permiten llamar a MATLAB desde sus propios programas de C/C++, mediante el uso de MATLAB como motor de cálculo. Para crear una aplicación del motor, llame a la función mex.
Las aplicaciones del motor requieren una versión instalada de MATLAB; no es posible ejecutar el motor de MATLAB en un equipo que solo tenga MATLAB Runtime.
API del motor para 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 |
Temas
Escribir aplicaciones del motor
- 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 on a Windows® platform that is already running. - Callbacks in Applications
Design user interface callbacks to be evaluated in the context of the base workspace.
Crear y ejecutar aplicaciones de Windows
- Build and Run C Engine Application on Windows
This example shows how to verify the build process on a Windows platform.
Crear y ejecutar aplicaciones de Mac
- Build and Run C Engine Application on macOS
This example shows how to verify the build process on a macOS platform.
Crear y ejecutar aplicaciones de Linux
- Build and Run C Engine Application on Linux
This example shows how to verify the build process on a Linux® platform.
Crear en un entorno de desarrollo integrado
Solución de problemas
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.