How can I associate a MATLAB function with events triggered by my .NET assemblies in MATLAB 7.8 (R2009a)?

2 views (last 30 days)
I would like to associate a MATLAB function with an event triggered by a .NET assembly that I am using in MATLAB. The associated MATLAB function will be executed when the event occurs.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Jul 2009
In order to register an event that can be triggered from a .NET assembly, you will need to use the function ADDLISTENER.
A modified version of the sample .NET component that is shipped with MATLAB is attached to this solution. The component is described in the documentation:
Using netdoc.NetSample
<http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/brpb58s-1.html#brx3746-1>
The attached example has been modified as follows:
1. The project has been upgraded to Microsoft VC++ 2008.
2. The file "SampleMethods.cs" now contains a function called "raiseEvents", which triggers an event a certain number of times.
3. The file "bin\Release\testevents.m" demonstrates how to register the event and test the functionality.
Additional information on .NET events can be found at the following location:
.NET Events in the MATLAB Workspace
<http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/brpb58s-1.html#br02q5j-1>

More Answers (0)

Products


Release

R2009a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!