Documentation

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 the Microsoft® .NET Framework. 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)
NET.addAssembly('System.Speech');
speak = System.Speech.Synthesis.SpeechSynthesizer;
speak.Volume = 100;
Speak(speak,text)
end

For an example rendering text to speech, type:

Speak('You can use .NET 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 the .NET Framework

For a complete description of the .NET Framework, you need to consult outside resources.

One source of information is the Microsoft Developer Network. Search the .NET Framework Development Center at http://msdn.microsoft.com/en-us/netframework/aa496123 for the term ".NET Framework Class Library". The .NET Framework Class Library is a programming reference manual. Many examples in this documentation refer to classes in this library. There are different versions of the .NET Framework 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.

More About

Was this topic helpful?