在matlab中建立一个function如下
function result = gridData(x,y,z,xi,yi)
result = gridData(x,y,z,xi,yi,'v4');
然后在C#中调用该函数 添加的引用:
using MathWorks.MATLAB.NET.Arrays;
using MathWorks.MATLAB.NET.Utility;
using gridData;
然后调用出问题了
protected void Page_Load(object sender, EventArgs e)
{
double[] dx= { 1.58,2.00,5.00,10.00};
MWNumericArray x = dx;
double[] dy = { 1.58, 2.00, 5.00, 10.00 };
MWNumericArray y = dy;
double[] dz = { 10.00, 20.15, 28.58, 45.63 };
MWNumericArray z = dz;
double tempx = 2.25;
double tempy = 2.25;
gridData.GridData gd = new GridData();
MWArray result = gd.gridData((MWArray)x, (MWArray)y, (MWArray)z, (MWArray)tempx, (MWArray)tempy);
Button1.Text = result.ToString();
}
//代码异常为MWMCR::EvaluateFunction error ...
Error using gridData
Too many input arguments.
Error in => gridData.m at line 2.
//何解 怎么解啊 老大们 大神们 第一次玩matlab 不懂啊
gd.gridData只有三个参数:返回值数组的维数,输出参数和输入参数
可以有多个参数 gd.gridData();调用时里面有十二种参数写法 问题我已经解决了 不是参数的问题