Borrar filtros
Borrar filtros

Use a DLL in Simulink

15 visualizaciones (últimos 30 días)
rents85
rents85 el 5 de Sept. de 2012
Hi to all,
i've created a DLL in C# language and i want to use it in simulink.
I'm able to use in Matlab command line:
dllPath = fullfile('c:','OwnProtocol2.dll');
NET.addAssembly(dllPath);
OwnProtocol2.sendsMeasures.writeInt()
How can i do this in Simulink?
The version of Matlab is 2010b

Respuesta aceptada

Ryan G
Ryan G el 5 de Sept. de 2012
Editada: Ryan G el 5 de Sept. de 2012
You can use a s-function to call the DLL. To do this you would need a header file describing the functions inside the DLL so the s-function knows how to call the functions inside the code. I'm not overly familiar with C# so I'm not sure how easy this will be but I am sure it is doable.
After you write the code just make sure to include the DLL in the mex line.
For example
mex mysfun.c myDLL.dll
  2 comentarios
rents85
rents85 el 5 de Sept. de 2012
Editada: rents85 el 5 de Sept. de 2012
Doesn't exist header file in C#...
Kaustubha Govind
Kaustubha Govind el 5 de Sept. de 2012
Not sure if you can link .NET assemblies directly against C-MEX S-functions (or any generic DLLs for that matter), but if you know how to invoke .NET assemblies from generic C/C++ DLLs, you can follow the same technique for C S-functions. Alternately, it might be easier to continue using your MATLAB code to call into the assembly. You can call MATLAB code from Simulink using the Interpreted MATLAB Function block or MATLAB S-Functions.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by