MATLAB Answers

How can I call a method in my .NET assembly from Simulink 7.3 (R2009a)?

2 views (last 30 days)
I want to call a function that is part of a .NET assembly from my Simulink model. I would like to know if this is possible.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 8 Nov 2019
Edited: MathWorks Support Team on 8 Nov 2019
Starting in MATLAB 7.8 (R2009a), the MATLAB interface to the .NET framework allows .NET assemblies to be loaded into MATLAB, create instances of .NET objects in the MATLAB workspace and to call methods from .NET assemblies.
In order to call a method from a .NET assembly in Simulink, utilize the "MATLAB Function" block in Simulink. Attached is an example showing how to call a method from a .NET assembly via a MATLAB function called from the MATLAB Function Simulink block.
In order to run the example, implement the following steps:
1. Save the attached files in a directory
2. In MATLAB 7.8 (R2009a), change your current working directory to the directory where you stored the files.
3. Open the .mdl file
4. Start simulation

  0 Comments

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2009a

Translated by