C# - 传递变量Matlab的 [英] C# - Passing variables to Matlab
问题描述
典型的谷歌搜索出来的空的,有些我呼吁你的伟大的思想:
我如何传递变量从C#类我写Matlab的(与我通过NET.addAssembly接口功能)??
有没有我应该在我的C#代码引用.dll文件?如果是的话,它在哪里?
是否有一些文档和示例如何从C#变量传递给Matlab的?
我怎么能投C#本地变量到Matlab阵列?
感谢。
这不是简单的,但你可以做到这一点。
首先,您需要使用C#编译* .DLL库。
你需要创建一个使用公共和私人功能的C#COM互操作类。 - 如何添加Microsoft.Kinect。 DLL来COM互操作的C#类
然后,你需要:
CMD -Run作为管理员
- 开C:\windows\Microsoft.NET\Framework\v4.0(或类似)的文件夹
在CMD窗口
-copy NAME_OF_YOUR_CLASS.cs到该文件夹
-CD路径目录
- 复制和粘贴CSC / T:库NAME_OF_YOUR_CLASS.cs
- 复制和粘贴regasm NAME_OF_YOUR_CLASS.dll / TLB /代码库
- 开放Matlab和使用net.Framework访问可用的功能
在MATLAB中,您需要:
净= actxserver('ImageCreationMatlab.ImageCreationMatlabClass');
VAL = net.depthKinectTwo(文件名,'kdpt',0,0,1);
这是只是跟着其他问题DLL的例子<。 / p>
我会尽力找到链接的类创建/教程。
Typical google search came out empty, some I'm calling upon your great minds: How can I pass variables from a C# class I'm writing to Matlab (with which I interface via the "NET.addAssembly" function)??
Is there a .dll file I should reference in my C# code? If yes, where is it? Are there some documentations and examples how to pass variables from C# to Matlab? How can I cast C# native variables into Matlab arrays?
Thanks.
It is not straightforward but you can do it.
First, you need to compile a *.DLL Library using C#. You need to create a c# COM interop class using public and private functions. - How to add Microsoft.Kinect.dll to COM Interop C# Class
Then, you need to:
-Run CMD as Administrator
-Open C:\windows\Microsoft.NET\Framework\v4.0 (or similar) folder
-cd path directory in the CMD window
-copy NAME_OF_YOUR_CLASS.cs to that folder
-copy and paste csc /t:library NAME_OF_YOUR_CLASS.cs
-copy and paste regasm NAME_OF_YOUR_CLASS.dll /tlb /codebase
-Open Matlab and use net.Framework to access the available functions
In MATLAB, you need to:
net = actxserver('ImageCreationMatlab.ImageCreationMatlabClass'); val = net.depthKinectTwo(filename,'kdpt',0,0,1);
This is just an example following the other question DLL.
I'll try to find the links/tutorial for the class creation.
这篇关于C# - 传递变量Matlab的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!