package matlab;
import com.mathworks.toolbox.javabuilder.*;
import com.eigenface.Eigenface;
public class Test {
public static void main(String[] args) {
Eigenface core = null;
Object [] result = null;
try {
core = new Eigenface();
result = core.EigenFace(2);
System.out.println(result[0]);
} catch (MWException e) {
e.printStackTrace();
}
}
}
我在包装器类中使用Matlab函数,称为Eigenface。当我运行我的代码,我得到这个异常:{??使用==> EigenFace出错输出参数太多。}。由于该函数在Matalab中工作没有问题,有人知道为什么我得到这个异常吗?
我相信你代码中的这个调用是不正确的:
result = core.EigenFace(2);
您的MATLAB函数的名称是EigenFace
吗?如果没有,您应该调用类似于:
result = core.yourfunction(2);
您可以在MATLAB文档中看到getmagic.java示例:
/* Create new magic object */
theMagic = new magic();
/* Compute magic square and print result */
result = theMagic.makesqr(1, n);
System.out.println(result[0]);