Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Events and Delegates

Use .NET event callbacks, create and call .NET delegates

Functions

BeginInvoke Initiate asynchronous .NET delegate call
EndInvoke Retrieve result of asynchronous call initiated by .NET System.Delegate BeginInvoke method
Combine Convenience function for static .NET System.Delegate Combine method
Remove Convenience function for static .NET System.Delegate Remove method
RemoveAll Convenience function for static .NET System.Delegate RemoveAll method

Topics

Use .NET Events in MATLAB

These examples use the addlistener function to handle .NET events with MATLAB® callbacks.

Call .NET Delegates in MATLAB

This example shows you how to use a delegate in MATLAB.

Create Delegates from .NET Object Methods

The following C# class defines the methods AddEggs and AddFlour, which have signatures matching the delInteger delegate:

Create Delegate Instances Bound to .NET Methods

For a C# delegate defined as:

Combine and Remove .NET Delegates

MATLAB provides the instance method Combine, that lets you combine a series of delegates into a single delegate.

Overview Events and Listeners

Use events and listeners to send and respond to messages.

.NET Delegates

In the .NET Framework, a delegate is a type that defines a method signature.

.NET Delegates With out and ref Type Arguments

The MATLAB rules for mapping out and ref types for delegates are the same as for methods.

Calling .NET Methods Asynchronously

It is possible to call a synchronous method asynchronously in MATLAB.

Troubleshooting

Limitations to Support of .NET Events

An event handler in C# is a delegate with the following signature:

Limitations to Support of .NET Delegates

MATLAB does not support associating a delegate instance with a generic .NET method.

Was this topic helpful?