问题描述
hi
我需要一些有关matlab编译DLL的调用的帮助(
下的C#deploytool). matlab函数是一个简单的函数,需要两个double并返回a
第三...
我向我的C#项目添加了必要的引用...
及其我的代码:
hi
I Need some help with the calling of a matlab compiled DLL (C# under
deploytool). The matlab function is a simple function THAT takes two double and return a
third...
i add necessary references to my c# project ...
and its my code :
Sum.Class1 a = new Sum.Class1();
MathWorks.MATLAB.NET.Arrays.MWArray[,] s=new MWArray[1,3];
a.sumab(2, 5, s);
listBox1 .Items.Add(s);
方法(sumab)返回void,我不知道如何获得输出...
我非常赞
如果我只写a.sumab(2,5);
它给了我一个错误:
"
the method (sumab) return void and i dont know how can get my output ...
im very amazing
if i just write a.sumab(2,5);
it gives me an error:
"
... MWMCR::EvaluateFunction error ...
Error using ==> sumab
Too many output arguments..
"
请帮助我的朋友
tnx很多
"
please help me friends
tnx a lot
推荐答案
a.sumab(2,5);
会产生错误.通常在matlab中,如果要从函数返回值,可以将其称为
will produce an error. Usually in matlab if you want a return value from a function you call it
s = a.sumab(2, 5);
,因为matlab没有参考参数.
我认为您应该重写您的Matlab函数,使其仅包含2个参数,并且当然会返回结果总和.
参见例如:
http://thinkmetric.com/tuts/matlab/functions.html [ ^ ]
但是话又说回来,为什么还要使用Matlab来完成如此简单的任务...
since matlab doesnt have reference parameters.
I think you should rewrite your Matlab function so that it only excepts 2 parameters and of course returns the result sum.
See for example:
http://thinkmetric.com/tuts/matlab/functions.html[^]
But then again why even use Matlab for such a simple task...
这篇关于使用“在matlab中创建的dll";在C#中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!