Chiamata di MATLAB da C++
L’API di MATLAB Engine per C++ fornisce un’interfaccia tra il linguaggio di programmazione di C++ e MATLAB. Questa API consente ai programmi C++ di avviare MATLAB, valutare le funzioni con argomenti di MATLAB e scambiare dati tra MATLAB e i programmi C++. Le operazioni supportate includono:
Avviare MATLAB.
Connettersi a una sessione condivisa di MATLAB sulla macchina locale.
Chiamare le funzioni di MATLAB con gli argomenti di input passati da C++ e le variabili di output restituite da MATLAB.
Valutare le dichiarazioni di MATLAB nel workspace di base di MATLAB.
Passare le variabili da C++ a MATLAB e da MATLAB a C++.
Per iniziare, vedere Set Up C++ Development Environment.
L’API di MATLAB Engine per C++ utilizza il API dei dati di MATLAB per C++, che fornisce un modo per le applicazioni in esecuzione al di fuori di MATLAB di lavorare con i dati di MATLAB attraverso un'interfaccia neutrale rispetto al linguaggio. L'API di engine fornisce inoltre un'interfaccia fortemente tipizzata che impone una rigorosa mappatura dei tipi di dati tra MATLAB e C++. È possibile utilizzare questa interfaccia fortemente tipizzata per chiamare funzioni e classi di MATLAB con i loro nomi MATLAB in C++, come se fossero funzioni e classi native di C++. Per un esempio, vedere Integrate Strongly Typed MATLAB Data in C++ Application.
Classi
Funzioni
Argomenti
Requisiti
- 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.
Integrazione di codice MATLAB in 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++.
Avvio e connessione a 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.
Chiamata delle funzioni di 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™.
Utilizzo del tipo di dati di MATLAB in 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.