我想MATLAB编码器输出,在Visual Studio C#项目纳入2010年我主要的想法是:集成Matlab的编码器使用C#
- 在Matlab中创建一个* .M脚本
- 确保脚本与Matlab编码器兼容。
- 生成一个C++共享库(DLL)用Matlab编码器
使用像这样用C#集成:
//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(); }
另外,我想能够停止执行,并检索某些部分结果。要做到这一点,我想在两个方法:
StopExecution
和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();
是否有可能呢?如果否,是否有其他选择?如果是的话,我可以在哪里找到更多的例子?
MATLAB编码器会产生从MATLAB功能独立的C/C++代码的要求,一个可怕的语言。你可以像使用其他本地代码一样在C#中使用它:P/Invoke – Amro
@Amro,你有这个实现的例子吗? (MATLAB编码器+ DLL + P /调用)。如果你有我给你50分! – guilhermecgs