使用“在matlab中创建的dll";在C#中 [英] problem with using a " dll created in matlab" in c#

查看:76
本文介绍了使用“在matlab中创建的dll";在C#中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

推荐答案

似乎至少调用了DLL中的函数.但是当然,如​​果函数需要3个参数,则调用
It seems the function in the DLL is at least called. But of course if the function expects 3 Parameters the call
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 [

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#中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆