.NET Assembly Integration
WithMATLAB Compiler SDK™, integrating compiled MATLAB functions into a .NET application involves using a combination of APIs that initializeMATLAB Runtime, load the compiled MATLAB functions intoMATLAB 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 areMWArray
, 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.dotNETAssembly |
Create .NET assembly for deployment outsideMATLAB |
compiler.build.DotNETAssemblyOptions |
Options for building .NET assemblies |
compiler.package.installer |
Create an installer for files generated byMATLABCompiler |
compiler.package.InstallerOptions |
Options for creatingMATLABCompilerpackage installers |
enableTSUtilsfromNetworkDrive |
Set trust setting to load .NET assemblies from network drive |
ntswrap |
Generate type-safe API |
MWArray Class Library Reference
Topics
Requirements and Highlights
- MATLAB Compiler SDK .NET Target Requirements
Refer to the software requirements for usingMATLAB Compiler SDKto create .NET Assemblies. - Common Integration Tasks and Naming Conventions
Learn the integration tasks performed by most users. - Install and Configure MATLAB Runtime
Install, configure, and uninstallMATLAB Runtime. - Set MATLAB Runtime Path for Deployment
Define paths for machines where you want to run applications generated withMATLAB Compiler™orMATLAB Compiler SDK.
Create and Integrate with .NET Framework
- Generate .NET Assembly and Build .NET Application
Create a .NET assembly in MATLAB and implement it with sample C# code. - Integrate .NET Assembly Into F# Application
使用f# integrate your assembly with less code.
Create and Integrate with .NET 5.0 and .NET Core
- Build .NET 5.0 Application That Runs on Linux and macOS
Create a .NET 5.0 application that can run on Linux®andmacOSsystems. - Build .NET Core Application That Runs on Linux and macOS
Create a .NET core application that can run on Linux andmacOSsystems.
示例应用程序
- 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 theMWObjectArray
class. - 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 Conversion
- Data Marshaling with MWArray API
Learn how theMWArray
classes 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 the MATLAB Compiler SDK
学习不同的类方法生成的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 API
- Type-Safe Interfaces
Consider using type-safe interfaces instead ofMWArray
to 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.
.NET Remoting
- 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
MWArray
and 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.