When I try:
ja = javaArray('double', 1, 1)
I get:
??? Error using ==> javaArray
No class double can be located on the MATLAB Java classpath
The documentation on javaArray says "You are more likely to use primitive types of double than instances of the java.lang.Double class, but in this context, it affords us a simple example."
However, I can't find an example where a primitive double array gets passed by reference from matlab to java.
Thanks,
Heeten
You are so right, there isn't an easy way to do that... Maybe you can write a java class to do just that:
public class DoubleArray {
public double[][] create(double rows, double cols) {
return new double[rows.intValue()][cols.intValue()];
}
}
Ed.
The problem I'm noticing with that approach is that returning an array from java to matlab seems to be very slow. It's faster to just create a memory mapped file in java and have matlab load the array from that. I was hopinh using javaArray would be faster than both of these approaches and less convoluted then the memory mapped file.
Any ideas on how to get data from java into matlab fast?