2011-12-28 62 views
0
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(); 

     } 
    } 

} 

我在一个名为Eigenface的包装类中使用了Matlab函数。当我运行我的代码时,我得到这个异常:{?错误使用==> EigenFace 输出参数太多。 }。 由于该函数在Matalab中没有问题,没有人知道为什么我会得到这个异常?Java与Matlab异常

回答

0

相信此调用你的代码是不正确的:

result = core.EigenFace(2); 

是您的MATLAB函数EigenFace的名字吗?如果没有,你应该调用类似:

result = core.yourfunction(2); 

你可以看到的例子getmagic.java MATLAB文档中:

/* Create new magic object */ 
theMagic = new magic(); 

/* Compute magic square and print result */ 
result = theMagic.makesqr(1, n); 
System.out.println(result[0]); 
+0

是的,sintax是正确的。我也尝试过你建议的例子,并且我得到了相同的异常,所以我猜这是代码以外的东西... – 2011-12-28 19:20:17