在matlab中使用C#编写的代码(Call C# code in matlab)
조회 수: 7 (최근 30일)
이전 댓글 표시
大家好。我需要对matlab中的遗传算法进行改进,具体改进内容是:将其中的目标函数的表达式部分替换为我用C#编写的代码,只要matlab中的输入参数传入这个C#代码,这个C#就能自动生成目标函数值。
我应该如何在matlab中调用C#的代码,是需要将C#代码打包为.dill文件然后让matlab调用吗?如果是这样的话,我应该怎么操作呢 ?
提前感谢!
Hi. I need to improve the Genetic Algorithm(GA) in matlab, the specific improvement content is: replace the objective function in the GA with the code I wrote in C#, as long as the input parameter in matlab is passed into this C# code, the C# code can automatically generate the objective function value.
How should I call C# code in matlab? Do I need to package C# code as a.dill file and let matlab call it? If so, what should I do?
Thanks in advance!
댓글 수: 0
답변 (1개)
Umang Pandey
2023년 9월 29일
Hi,
Yes, you can call your C# function from MATLAB by packaging C# code in a DLL file. You can refer the following documentation for more information:
The documentation explains how you can call .NET library functionalities directly from MATLAB.
Best,
Umang
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Compiler SDK에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!