【发布时间】:2016-02-02 10:42:22
【问题描述】:
我创建了一个这样的matlab函数
function max = mymax(n1,n2,n3,n4,n5)
%This function calculates the maximum of the
% five numbers given as input
max = n1;
if(n2 > max)
max = n2;
end
if(n3 > max)
max = n3;
end
if(n4 > max)
max = n4;
end
if(n5 > max)
max = n5;
end
end
然后我从它那里得到了一个引用我的 c# windows 窗体项目的 .dll。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Mymax;
using MathWorks.MATLAB.NET.Arrays;
using MathWorks.MATLAB.NET.Utility;
namespace Mymax_with_Matlab
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Mymax.Mymax c1 = new Mymax.Mymax();
int a = Convert.ToInt32(c1.mymax(1, 2, 3, 4, 5));
}
}
}
mymax 是我的 dll 文件的名称。以下是停止我的应用程序的错误:
... MWMCR::EvaluateFunction error ...
Not enough input arguments.
Error in => mymax.m at line 14.
... Matlab M-code Stack Trace ...
at
file C:\Users\milad\AppData\Local\Temp\milad\mcrCache8.1\Mymax_0\Matlab Examples\mymax.m, name mymax, line 14.
请帮帮我....谢谢:)
【问题讨论】:
-
我的猜测是它与您使用名为
max的变量有关,它是内置的,因为您的错误在mymax.m at line14中。尝试将该名称更改为maximum_val
标签: c# matlab function call matlab-compiler