Main Content

Load a Global .NET Assembly

This example shows you how to make .NET classes visible to MATLAB® by loading a global assembly using the NET.addAssembly function.

The speech synthesizer class (available in .NET Framework Version 3.0 and above) provides ready-to-use text-to-speech features. For example, type:

speak = System.Speech.Synthesis.SpeechSynthesizer;
speak.Volume = 100;
Speak(speak,'You can use .NET Libraries in MATLAB')

The speech synthesizer class, like any .NET class, is part of an assembly. To work with the class, call NET.addAssembly to load the assembly into MATLAB. Your vendor documentation contains the assembly name. For example, search Microsoft® .NET documentation for the System.SpeechSynthesizer class. The assembly name is System.Speech.


The System.Speech assembly is a global assembly. If your assembly is a private assembly, use the full path for the input to NET.addAssembly.

The System.DateTime Example does not call NET.addAssembly because MATLAB dynamically loads its assembly (mscorlib) at startup.


You cannot unload an assembly in MATLAB. If you modify and rebuild your own assembly, you must restart MATLAB to access the changes.

See Also

Related Topics