Main Content

Deploy to .NET Applications Using MWArray API

Integrate packaged MATLAB® functions into .NET applications using the MWArray API for data exchange

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 data types.

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.

Functions

compiler.build.dotNETAssemblyCreate .NET assembly for deployment outside MATLAB (Since R2021a)
compiler.build.DotNETAssemblyOptionsOptions for building .NET assemblies (Since R2021a)
compiler.build.ResultsCompiler build results object (Since R2020b)
compiler.package.installerCreate an installer for files generated by MATLAB Compiler (Since R2020a)
compiler.package.InstallerOptionsOptions for creating MATLAB Compiler package installers (Since R2020a)
enableTSUtilsfromNetworkDriveSet trust setting to load .NET assemblies from network drive
ntswrapGenerate type-safe API

Classes

expand all

MWArrayEncapsulate native MATLAB mxArray
MWCellArrayManaged representation of MATLAB cell array
MWCharArrayManaged representation of MATLAB character array
MWIndexArrayRoot for MWArray indexing classes
MWLogicalArrayManaged representation of MATLAB logical array
MWNumericArrayManaged representation of MATLAB numeric array types
MWObjectArrayWrap native .NET object in MATLAB array type
MWStringArrayManaged representation of MATLAB string array
MWStructArrayManaged representation of MATLAB structure array
MWArrayType EnumerationMWArray type enumeration
MWArrayComponent Enumeration MATLAB numeric array component enumerator
MWArrayComplexity EnumerationMATLAB numeric array complexity enumerator
MWNumericType EnumerationMATLAB numeric array data type enumerator
MWArrayEncapsulate native MATLAB mxArray
MWCellArrayManaged representation of MATLAB cell array
MWStructArrayManaged representation of MATLAB structure array
ImagesConvert RGB data from MATLAB into .NET System.Drawing.Image object
LOGFILEAttributeRepresents MATLAB Runtime option that allows users to pass name of logfile that catches MATLAB Runtime output
MATLABSignatureEmbed MATLAB function signature information in assembly
MCRVersionTag assembly with version of MATLAB Runtime that it requires
MWCTFStreamReaderRead CTF bytes from stream
MWExceptionGet stack trace of M-Code
MWMCRRead CTF bytes from stream
MWMCROptionAttributeRepresent MATLAB Runtime option
NativeGCAttributeDefine custom assembly attribute that keeps track of native heap allocations for instances of MWArray classes
NOJVMAttribute MATLAB Runtime option that allows users to launch MATLAB Runtime without JAVA Virtual Machine support

Topics

Requirements

Create and Integrate with .NET Framework

Create and Integrate with .NET 6.0

Sample Applications

Data Conversion

Type-Safe API

.NET Remoting

Troubleshooting .NET Assemblies