【问题标题】:Java & Matlab ExceptionJava 和 Matlab 异常
【发布时间】:2011-12-29 01:00:36
【问题描述】:
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


    【解决方案1】:

    我认为您代码中的这个调用不正确:

    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]);
    

    【讨论】:

    • 是的,sintax 是正确的。我还尝试了您建议的示例,并且遇到了相同的异常,所以我想这与代码不同...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-01
    • 2014-02-18
    • 1970-01-01
    • 1970-01-01
    • 2011-12-07
    • 1970-01-01
    相关资源
    最近更新 更多