Call MATLAB from .NET
Write .NET programs that work with MATLAB®
The MATLAB Engine API for .NET provides an interface between .NET programming languages and MATLAB. This API enables programs to launch MATLAB, evaluate MATLAB functions with arguments, and exchange data between MATLAB and .NET programs.
If you need to maintain existing .NET programs created for MATLAB R2022a or earlier that work with the Microsoft® Component Object Model (COM), see Write COM Applications to Work with MATLAB.
To access .NET libraries directly from MATLAB instead, see Call .NET from MATLAB.
Functions
Classes
Topics
Set Up and Build Engine Applications
- Requirements to Build .NET Engine Programs
Set environment variables, and compile and run your .NET code. - Test Your .NET Development Environment
Confirm your development environment for the MATLAB .NET engine.
Data Mapping
- Pass .NET Data Types to MATLAB Functions
Convert .NET data to MATLAB data. - Handle MATLAB Data in .NET Applications
Convert MATLAB data to .NET data.
Use MATLAB Engine API for .NET
- Elements of a .NET Engine Program
Get started with the MATLAB Engine API for .NET. - Start MATLAB Session from .NET
Start a .NET engine session synchronously or asynchronously, pass startup options to MATLAB. - Connect .NET Application to Running MATLAB Session
Connect the .NET engine to a running MATLAB session that has been started as or converted to a shared session. - Execute MATLAB Functions from .NET
Pass variables to MATLAB function calls and return values to .NET applications. - Use MATLAB Structures in .NET
Define MATLAB structure data types in .NET using theMathWorks.MATLAB.Types.MATLABStruct
class.
Troubleshooting
MathWorks.MATLAB.Exceptions Exception Classes for .NET
The MathWorks.MATLAB.Exceptions
namespace contains the
exception classes for the .NET engine.