Main Content

Call MATLAB from .NET

Write .NET programs that work with MATLAB®

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.

To access .NET libraries directly from MATLAB instead, see Call .NET from MATLAB.

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.

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
matlab.engine.typedinterface.generateCSharpGenerate C# code interface for MATLAB packages, classes, and functions (Since R2023b)

Classes

expand all

bat365.MATLAB.Engine.MATLABEngine .NET class using MATLAB as a computational engine (Since R2022b)
bat365.MATLAB.Types.MATLABArray.NET class to represent pointers to MATLAB arrays (Since R2022b)
bat365.MATLAB.Types.MATLABObject.NET class to represent scalar instances of MATLAB classes (Since R2022b)
bat365.MATLAB.Types.MATLABStruct.NET class to represent scalar MATLAB structures (Since R2023a)
bat365.MATLAB.Types.MATLABWorkspace.NET class to manage interactions with MATLAB base workspace variables (Since R2022b)
bat365.MATLAB.Types.RunOptions.NET class to specify options for MATLAB function evaluation (Since R2022b)
bat365.MATLAB.Types.MATLABProvider.NET base class for invoking MATLAB functions (Since R2023b)

Topics

Set Up and Build Engine Applications

Start MATLAB from .NET Application

Call MATLAB Functions from .NET

Troubleshooting

bat365.MATLAB.Exceptions Exception Classes for .NET

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

Related Information