要做的东西需要用到matlab生成的函数dll,我用的是D:\MatLab2009\toolbox\matlab\specfun\\erf.m 直接生成的dll,然后按教程(c#调用matlab函数(混合编程).doc)做,教程上的函数粘贴进去成功运行,但是我用自己的erf函数时候,总是传递参数出问题,查阅资料(C#与MATLAB之间传递参数。doc)不能解决,求大神帮忙~!
下面是我改得乱七八糟的代码::
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;using MathWorks.MATLAB.NET.Arrays;//在MWArray.dll,最常用的
using MathWorks.MATLAB.NET.Utility;// 在MWArray.dll,最常用的
using erfc;//这个就是我们自己定义的,里面有matlab函数namespace erfccc
{
    class Program
    {
        static void Main(string[] args)
        {            erfc.Myclass E = new Myclass();
            Console.WriteLine("输入x的值:");
            int x = Convert.ToInt32(Console.ReadLine());
            //int[] n = { x};
            MathWorks.MATLAB.NET.Arrays.MWArray m = x;
            MathWorks.MATLAB.NET.Arrays.MWNumericArray k;
            k = E.erfc(m);
            //MWNumericArray temp = (MWNumericArray)k;
            double[] location = (double[])k.ToVector(MWArrayComponent.Real);            Console.WriteLine(location[0].ToString());
        }
    }
}