Integrating Matlab Coder with c#
이전 댓글 표시
Hi,
I want to integrate Matlab Coder output with a C# project in Visual Studio. My main idea is:
- Create a *.m script in Matlab
- Make sure the script is compatible with Matlab Coder.
- Generate a C++ shared library (DLL) with Matlab Coder
- Integrate with C# using something like this:
//Starts the model execution. May take several minutes
public static class DllHelper
{
[DllImport(@"test.dll",CallingConvention=CallingConvention.Cdecl,EntryPoint = "Run()")]
public static extern int Run();
}
- Also, I would like to be able to stop the execution and retrieve some partial results. To do this, I was thinking in two methods: StopExecution and RetrievePartialResults
[DllImport(@"test.dll",CallingConvention=CallingConvention.Cdecl,EntryPoint = "StopExecution ()")]
public static extern int StopExecution ();
[DllImport(@"test.dll",CallingConvention=CallingConvention.Cdecl,EntryPoint = "RetrievePartialResults()")]
public static extern MyResults RetrievePartialResults();
- Is it possible to do?
- If no, is there any alternatives?
- If yes, where can I find more examples?
채택된 답변
추가 답변 (1개)
Bill Chou
2020년 3월 23일
2 개 추천
Yes, it's possible to use MATLAB Coder to integrate with C# applications. One would need to make some manually changes at the interface. Please see this article for more details:
카테고리
도움말 센터 및 File Exchange에서 MATLAB Coder에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!