.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
In this approach, you create an archive containing MATLAB functions and deploy it within a .NET application. Use the MATLAB Compiler SDK API for .NET as an interface between .NET applications and MATLAB code deployed within those applications. Use the MATLAB Data API for .NET to handle the data exchange between a .NET application and deployed MATLAB code. All .NET applications created using MATLAB Compiler SDK API for .NET and MATLAB Data API for .NET can be built on Windows® and executed on Linux® and macOS as long as you are using .NET 5.0 or higher. This approach was introduced in R2022b.
Deploy to .NET Applications using MWArray API
In this approach, you create a .NET assembly consisting of a managed class that encapsulates the MATLAB functions you want to deploy. To access functionality provided by the deployed MATLAB functions, instantiate the managed class from the assembly in your C# code, and call the methods that encapsulate the MATLAB functions. Use the
MWArrayAPI to handle the data exchange between a .NET application and deployed MATLAB code.
MATLAB Runtime must be installed and setup on the machine running the .NET application.
Since MATLAB Compiler SDK provides two .NET APIs to interact with deployed MATLAB functions, the two APIs are distinguished based on the APIs used for exchanging data between the .NET application and the deployed MATLAB functions.
MathWorks® recommends using the MATLAB Compiler SDK API for .NET with the MATLAB Data API for .NET. and Microsoft®.NET 5.0 or higher to deploy MATLAB functions across the broadest array of platforms.
- 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