I'm trying to call a java function from a Matlab
script, I tried all the solutions put in the website but I didn't get an issue.
My class is simple:
package testMatlabInterface;
public class TestFunction
{
private double value;
public TestFunction()
{
value=0;
}
public double Add(double v)
{
value += v;
return value;
}
public static void main(String args[])
{
}
}
So I put .java
file (also .class
) in my workingspace C:\scriptsMatlab
and I added this path to javaclasspath
of Matlab, but when I try to call the function , it tells me that there's no class with this name in javaclasspath
of Matlab
.
EDIT: Here's the version of java that Matlab uses:
Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
And this is the version on jdk which I used to compile my class :
But when I try to execute this commande from matlab
>> javaaddpath 'C:\scriptsMatlab'
>> obj = TestFunction
it tells me:
Undefined function or variable 'TestFunction'.