在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!