Erste Schritte in Microsoft .NET
Durch die Schnittstelle zu .NET können Sie .NET-Assemblys in die MATLAB-Umgebung integrieren und Objekte aus in den Assemblys enthaltenen Klassen erstellen sowie Methoden für diese Objekte aufrufen.
MATLAB unterstützt das Laden folgender .NET-Assemblys:
.NET, einschließlich .NET Core (Microsoft® Windows®, macOS und Linux®)
.NET Framework (nur Windows)
Weitere Informationen finden Sie unter System Requirements for Using MATLAB Interface to .NET. Informationen über mit MATLAB kompatible .NET-Versionen finden Sie unter MATLAB-Schnittstellen zu anderen Sprachen.
Mit der Funktion NET.isNETSupported bestimmen Sie, ob Ihr System über eine unterstützte Version verfügt.
Funktionen
NET.addAssembly | Make .NET assembly visible to MATLAB |
NET.unloadAssembly | Unload .NET Core assembly from MATLAB (Seit R2026a) |
NET.isNETSupported | Check for supported version of Microsoft .NET |
NET.interfaceView | Explicit interface view of .NET object (Seit R2023b) |
Klassen
NET.Assembly | Members of .NET assembly |
Objekte
NET.NetException | Capture error information for .NET exception |
Namespaces
NET | Summary of functions and classes in MATLAB .NET interface |
Themen
- System Requirements for Using MATLAB Interface to .NET
Using a supported version of .NET.
- Access a Simple .NET Class
This example shows how to access .NET functionality already installed on your system.
- Build and Load .NET Assembly for MATLAB
Build and load a .NET assembly.
- Save and Load .NET Objects in MAT Files
When you save and load .NET objects in MAT files, MATLAB uses
System.Runtime.Serialization.DataContractSerializerto perform the serialization and deserialization. - Simplify .NET Class Names
Use the MATLAB
importfunction to refer to .NET class names. - Use import in MATLAB Functions
Guidelines for using the
NET.addAssemblyandimportfunctions. - Use .NET Nested Classes and Enumerations
Using reflection to instantiate a nested class or enumeration.
- Handle .NET Exceptions
MATLAB catches exceptions thrown by .NET and converts them into a
NET.NetExceptionobject. - Assembly Is a Library of .NET Classes
An assembly is a collection of types and resources built to work together and form a logical unit of functionality in .NET applications.
- Use .NET from MATLAB
How you can benefit from using .NET from MATLAB.
- Create .NET Objects
How to create a .NET object.
- .NET Terminology
Understanding namespaces and reference and value types.
- Work with Microsoft Excel Spreadsheets Using .NET
This example for Microsoft .NET Framework uses the
Microsoft.Office.Interop.Excel.ApplicationClassclass to create a spreadsheet, copy MATLAB data to it, and then close it. - Work with Microsoft Word Documents Using .NET
This example for Microsoft .NET Framework uses the
Microsoft.Office.Interop.Word.ApplicationClassclass to create a Word document.
Fehlersuche
Troubleshooting Security Policy Settings from Network Drives
For MATLAB releases R2012b or earlier, call the
enableNETfromNetworkDrive function to create a
MATLAB security policy entry.
.NET features not supported in MATLAB.
Limitations to Support of .NET Arrays
.NET features not supported in MATLAB.
Limitations to Support of .NET Events
.NET features not supported in MATLAB.
Limitations to Support of .NET Delegates
.NET features not supported in MATLAB.
Limitations to Support of .NET Enumerations
.NET features not supported in MATLAB.