This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Package: NET

Make .NET assembly visible to MATLAB


asmInfo = NET.addAssembly(globalName)
asmInfo = NET.addAssembly(privateName)


asmInfo = NET.addAssembly(globalName) loads a global .NET assembly into MATLAB®.

asmInfo = NET.addAssembly(privateName) loads a private .NET assembly.


  • NET.addAssembly does not support assemblies generated by the MATLAB Compiler SDK™ product.

Input Arguments


One of the following:

  • String or character vector representing the name of a global assembly.

  • Instance of System.Reflection.AssemblyName class.


String or character vector representing the full path of a private assembly.

Output Arguments


NET.Assembly object containing names of the members of the assembly.


Display today’s date using System.DateTime in the mscorlib assembly.


Call the System.Windows.Forms.MessageBox.Show method in the global assembly System.Windows.Forms.

asm = NET.addAssembly('System.Windows.Forms');
import System.Windows.Forms.*
MessageBox.Show('Simple Message Box')

Display classes in the private assembly NetSample.dll.

asm = NET.addAssembly('c:\work\NetSample.dll');


  • You do not need to call NET.addAssembly to access classes in the mscorlib.dll and system.dll assemblies. MATLAB dynamically loads these assemblies from the .NET Framework class library the first time you type "NET." or "System.".

  • Refer to your .NET product documentation for the name of the assembly and its deployment type (global or private).

Introduced in R2009a