Java 在Matlab中使用org.apache
我试图通过以下方式使用Matlab中的org.apache:Java 在Matlab中使用org.apache,java,matlab,apache-commons,Java,Matlab,Apache Commons,我试图通过以下方式使用Matlab中的org.apache: javaaddpath('~/.m2/repository/org/apache/commons/commons-math3/3.2/commons-math3-3.2.jar'); import org.apache.commons.math3.stat.correlation.* c = org.apache.commons.math3.stat.correlation.KendallsCorrelation(); 我得到以下
javaaddpath('~/.m2/repository/org/apache/commons/commons-math3/3.2/commons-math3-3.2.jar');
import org.apache.commons.math3.stat.correlation.*
c = org.apache.commons.math3.stat.correlation.KendallsCorrelation();
我得到以下错误:
Undefined variable "org" or class "org.apache.commons.math3.stat.correlation.KendallsCorrelation"
如何修复它?KendallsCorrelation类仅在数学版本3.3中存在,我正在尝试使用版本3.2。以下代码起作用:
javaaddpath('~/matlab/jars/commons-math3-3.3/commons-math3-3.3.jar');
import org.apache.commons.math3.stat.correlation.*
c = org.apache.commons.math3.stat.correlation.KendallsCorrelation();
c.correlation([4 2 0], [3 2 1])
问题是Matlab使用的是Java6,而我的机器上安装了Java7吗?如果是这样的话,我该如何解决这个问题呢?事实证明,Kendall的相关性并没有出现在数学版本3.2中,而是出现在3.3中。我已经下载并导入了这个版本,现在它似乎可以工作了。