Main Content

Build a .NET Application for MATLAB Examples

You can use C# code examples in MATLAB®, such as the NetDocCell assembly provided in Convert .NET Arrays to Cell Arrays. Build an application using a C# development tool, like Microsoft® Visual Studio® and then load it into MATLAB using the NET.addAssembly function. The following are basic steps for building; consult your development tool documentation for specific instructions.

  1. From your development tool, open a new project and create a C# class library.

  2. Copy the classes and other constructs from the C# files into your project.

  3. Build the project as a DLL.

  4. The name of this assembly is the namespace. Note the full path to the DLL file. Since it is a private assembly, you must use the full path to load it in MATLAB.

  5. After you load the assembly, if you modify and rebuild it, you must restart MATLAB to access the new assembly. You cannot unload an assembly in MATLAB.

Related Topics