.NET Assembly Integration
MATLAB Compiler SDK™ provides two ways to deploy MATLAB functions within .NET applications:
Deploy to .NET Applications using MATLAB Data API for .NET (since R2022b)
Deploy to .NET Applications using
MWArray
API (since R2006a)
Deploying MATLAB code to a .NET application using the MATLAB Data API for .NET is the newer and modern of the two options and offers the following advantages:
You can program with native .NET types by specifying a mapping between C# and MATLAB data types using
arguments
blocks with type information within MATLAB code. This eliminates the need to manage MATLAB data types in C#.The MATLAB Runtime instance can run either in-process or out-of-process with respect to the .NET application, and deployed MATLAB functions can be executed either synchronously or asynchronously.
Thread-safe design facilitates concurrent data creation and consumption across multiple threads without the need for locking. This leads to improved performance, particularly when there's extensive manipulation of MATLAB data in multiple threads.
MATLAB class methods are now exposed, enabling direct invocations on the class object.
Transitioning between .NET based MATLAB Engine applications and deployed MATLAB applications can now be accomplished with minimal effort.
Support for cross-platform development and deployment. Since R2023a, .NET applications with packaged MATLAB code can be developed and published across Windows®, Linux®, and macOS platforms. This means it's possible to develop on any one of these platforms and publish to any of the other two.
MathWorks® recommends deploying to .NET using the MATLAB Data API for .NET. and Microsoft®.NET 5.0 or higher to deploy MATLAB functions across the broadest array of platforms. However, to select the right deployment option for your project, see Choose .NET Deployment Option.
MATLAB Runtime must be installed and set up on the machine running the .NET application. For details, see Download and Install MATLAB Runtime.
Categories
- Deploy to .NET Applications Using MATLAB Data API for .NET
Integrate packaged MATLAB functions into .NET applications using the MATLAB Data API for data exchange
- Deploy to .NET Applications Using MWArray API
Integrate packaged MATLAB functions into .NET applications using the MWArray API for data exchange