Main Content

Using .NET from MATLAB

Benefits of the MATLAB .NET Interface

The MATLAB® .NET interface enables you to:

  • Create instances of .NET classes.

  • Interact with .NET applications via their class members.

Why Use the MATLAB .NET Interface?

Use the MATLAB .NET interface to take advantage of the capabilities of a Microsoft® .NET. For example:

  • You have a professionally developed .NET assembly and want to use it to do certain operations, such as access hardware.

  • You want to leverage the capabilities of programming in .NET (for example, you have existing C# programs).

  • You want to access existing Microsoft-supplied classes for .NET.

The speech synthesizer class (available in .NET Framework Version 3.0 and above) is an example of a ready-to-use feature. Create the following Speak function in MATLAB:

function Speak(text)
speak = System.Speech.Synthesis.SpeechSynthesizer;
speak.Volume = 100;

For an example rendering text to speech, type:

Speak('You can use .NET Framework libraries in MATLAB')

NET Assembly Integration Using MATLAB Compiler SDK

The MATLAB .NET interface is for MATLAB users who want to use .NET assemblies in MATLAB.

NET Assembly Integration in the MATLAB Compiler SDK™ product packages MATLAB functions so that .NET programmers can access them. It brings MATLAB into .NET applications. For information about NET Assembly Integration, see the MATLAB Compiler SDK product documentation.

To Learn More About .NET

For a complete description of .NET, you need to consult outside resources. One source of information is There are different versions of .NET documentation, so be sure to refer to the version that is on your system. See System Requirements for Using MATLAB Interface to .NET for information about version support in MATLAB.

Related Topics