Main Content

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

expand all

matlab.engine.shareEngineConvert running MATLAB session to shared session
matlab.engine.engineNameReturn name of shared MATLAB session
matlab.engine.isEngineSharedDetermine if MATLAB session is shared

Classes

expand all

MathWorks.MATLAB.Engine.MATLABEngine .NET class using MATLAB as a computational engine
MathWorks.MATLAB.Types.MATLABArray.NET class to represent pointers to MATLAB arrays
MathWorks.MATLAB.Types.MATLABObject.NET class to represent scalar instances of MATLAB classes
MathWorks.MATLAB.Types.MATLABWorkspace.NET class to manage interactions with MATLAB base workspace variables
MathWorks.MATLAB.Types.RunOptions.NET class to specify options for MATLAB function evaluation

Topics

Set Up and Build Engine Applications

Data Mapping

Use MATLAB Engine API for .NET

Troubleshooting

MathWorks.MATLAB.Exceptions Exception Classes for .NET

The MathWorks.MATLAB.Exceptions namespace contains the exception classes for the .NET engine.

Related Information