필터 지우기
필터 지우기

Use a DLL in Simulink

조회 수: 15 (최근 30일)
rents85
rents85 2012년 9월 5일
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

채택된 답변

Ryan G
Ryan G 2012년 9월 5일
편집: Ryan G 2012년 9월 5일
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
rents85
rents85 2012년 9월 5일
편집: rents85 2012년 9월 5일
Doesn't exist header file in C#...
Kaustubha Govind
Kaustubha Govind 2012년 9월 5일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by