The NET.addAssembly
function loads the .NET assembly and makes it available in MATLAB. The variable returned is actually a "meta object" containing information about the classes, enums, structs, etc.. contained in the assembly.
If you want to work with whatever classes are exposed by the library, you have to instantiate objects as usual (or call static functions directly if available). The documentation explains this very well.
As an example, take the following C# class:
MyClass.cs
using System;
namespace ClassLibraryTest
{
public class MyClass
{
public static double add(double x, double y)
{
return x + y;
}
public double negate(double x)
{
return -x;
}
}
}
First we compile it into an .NET assembly, the we use it in MATLAB:
> csc.exe /target:library /out:ClassLibraryTest.dll MyClass.cs
MATLAB
% load my assembly
info = NET.addAssembly( fullfile(pwd,'ClassLibraryTest.dll') );
% call static method
result = ClassLibraryTest.MyClass.add(1,2)
% instantiate instance of class and call member function
c = ClassLibraryTest.MyClass();
result = c.negate(1)
You can now inspect the properties and methods of the class as usual:
>> properties(c)
>> methods(c)
>> methodsview ClassLibraryTest.MyClass