I am trying to call a Java method that takes a double array argument:
class mySum { public static double sum(double[] in) { double accum = 0; for (int i = 0; i < in.length; i++) { accum += in[i]; } return accum; } }
When I inspect the class using METHODS:
methods('mySum','-full')
MATLAB reports the following signature:
... static double sum(double[]) ...
I instantiate a java array of Doubles using the JAVAARRAY function in MATLAB and then call the method:
ja = javaArray('java.lang.Double',2)ja(1) = java.lang.Double(11)ja(2) = java.lang.Double(12)b = mySum.sum(ja)
However, I receive the following error: ERROR: ??? No method 'sum' with matching signature found for class 'mySum'.
Best Answer