Deploy to .NET Applications Using MWArray API
With MATLAB Compiler SDK™, integrating compiled MATLAB functions into a .NET application involves using a combination of APIs that initialize MATLAB Runtime, load the compiled MATLAB functions into MATLAB Runtime, and manage the data that passes between the .NET code and MATLAB.
The two data conversion APIs that marshal and format data between .NET
and MATLAB are
MWArray, which uses derived types
that map to MATLAB data types, and the native .NET API, which uses native
.NET types and supports .NET remoting. In addition, type-safe interfaces
provide an alternate set of methods that work directly with native .NET
To integrate MATLAB functions with servers developed in .NET, use either the .NET remoting API or the Windows Communications Foundation framework from Microsoft®. These APIs facilitate the development of distributed applications with features for deploying active figures over the web and accessing .NET remoting capabilities.
|Create .NET assembly for deployment outside MATLAB (Since R2021a)
|Options for building .NET assemblies (Since R2021a)
|Create an installer for files generated by MATLAB Compiler (Since R2020a)
|Options for creating MATLAB Compiler package installers (Since R2020a)
|Set trust setting to load .NET assemblies from network drive
|Generate type-safe API
MWArray Class Library Reference
- MATLAB Compiler SDK .NET Target Requirements
Refer to the software requirements for using MATLAB Compiler SDK to create .NET assemblies.
- Setting Up .NET Development Environment
Set up development environment to develop .NET applications containing deployed MATLAB code.
- Choosing .NET Deployment Option
Explore .NET deployment options that MATLAB Compiler SDK offers and select the right one for your specific .NET integration needs.
- Summary of MATLAB Compiler SDK .NET APIs
Explore the various MATLAB Compiler SDK .NET APIs.
- Install and Configure MATLAB Runtime
Install, configure, and uninstall MATLAB Runtime.
- Set MATLAB Runtime Path for Deployment
Define paths for machines where you want to run applications generated with MATLAB Compiler™ or MATLAB Compiler SDK.
Create and Integrate with .NET Framework
- Generate .NET Assembly and Build .NET Application
Create a .NET assembly in MATLAB and integrate it with sample C# code.
- Package .NET Assemblies from Command Line
mccat the command line to build an assembly.
- Integrate .NET Assembly into F# Application
Use F# to integrate your assembly with less code.
- Common Integration Tasks and Naming Conventions
Learn the integration tasks performed by most users.
Create and Integrate with .NET 6.0
- Deploy MATLAB Function to Cross-Platform .NET 6.0 Application Using MWArray API
Learn how to package and deploy a MATLAB function to a cross-platform .NET 6.0 application written in C# using the MWArray API.
- Create Sample Code to Call Exported Function
Generate sample code in C++, .NET, Java®, or Python® by including sample files during packaging.
- Integrate Simple MATLAB Function into .NET Application
Build a .NET application using C# or Visual Basic®.
- Integrate Function with Variable Number of Arguments
Build a .NET application using a MATLAB function that takes a variable number of arguments.
- Assign Multiple MATLAB Functions in Component Class
Create a .NET assembly containing multiple functions to implement a matrix math program.
- Integrate MATLAB Optimization Routines with Objective Functions
Build a .NET assembly that applies optimization routines to objective functions using the
- Use Multiple Classes in .NET Assembly
Create a .NET assembly containing multiple classes to implement a signal analyzer application.
- Block Console Display When Creating Figures
Handle interaction in a console-based program that creates MATLAB figures.
- Data Marshaling with MWArray API
Learn how the
MWArrayclasses convert data between .NET and MATLAB.
- Convert Data Between .NET and MATLAB
See examples on manually converting between native .NET data types and MATLAB types.
- Rules for Data Conversion Between .NET and MATLAB
Refer to the rules for converting .NET types to MATLAB types.
- Interfaces Generated by MATLAB Compiler SDK
Learn the different class methods generated for each MATLAB function.
- Specify Parallel Computing Toolbox Profile in .NET Application
Specify profile information for Parallel Computing Toolbox™ applications.
- Limitations on Multiple Assemblies in Single Application
See the data types that cannot be shared across .NET assemblies.
- Type-Safe Interfaces
Consider using type-safe interfaces instead of
MWArrayto work directly with native data types.
- Implement Type-Safe Interface and Integrate into .NET Application
Create a multiplication program that uses native .NET data types through a type-safe interface.
- Create Managed Extensibility Framework Plug-Ins
Extend .NET applications with Managed Extensibility Framework (MEF) plug-ins using a type-safe API.
- Create Remotable .NET Assembly
Build a remotable .NET component using the Library Compiler app or programmatically.
- Compare MWArray and Native .NET API for Remotable Assemblies
Decide between the
MWArrayand native .NET APIs for data marshaling in an assembly.
- .NET Remoting and Windows Communications Foundation
Learn the advantages of implementing remotable .NET components.
- Create Windows Communications Foundation Component
Deploy a Windows® Communications Foundation (WCF) component using a type-safe API.
Troubleshooting .NET Assemblies
- Error Handling and Resource Management
Handle errors generated by MATLAB and manage resources explicitly.
- Failure to Find MATLAB Runtime Files
View solutions to problems when files cannot be found.
- Failure to Find MATLAB Classes
Solutions to problems when classes cannot be found.
- Diagnostic Messages
List of diagnostic messages with suggestions about their cause.