I am currently call Matlab object in my java code .
The code of matlab is easy like this
function idx = clustering(W, k)
degs = sum(W, 2);
D = sparse(1:size(W, 1), 1:size(W, 2), degs);
L = D-W;
[V,dummy] = eigs(W,k,'sr');
idx = kmeans(V, k);
end
It is easy to use the object Clustering in Java.
I generate an object with code like this,
Spclustering specClusteringcol = null;
try {
specClusteringcol = new Spclustering();
} catch (MWException e) {
e.printStackTrace();
}
.......do some thing
if(specClusteringcol!=null)
specClusteringcol.dispose();
If I run simple demo in a single thread , this works correctly.
However, if I run some time cost task
the runtime will give out an exception
Undefined function 'javaaddpath' for input arguments of type 'cell'.
Why this happens? How to solve it?