1.VS 建立一个类库工程
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Matleb1
{
public class Class1
{
public static int method1()
{
return 15;
}
}
}
shift+F6编译
2.打开matlab R2014 输入以下两行
>> NET.addAssembly('d:\vsProject\Matleb1\Matleb1\bin\Debug\Matleb1.dll')
>> Matleb1.Class1.method1()
结果:
ans =
15