Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think the original problem has been <a href="https://stackoverflow.com/questions/464216/strange-classes-passed-from-matlab-to-java#466400">updated by the OP</a>, so I'll take the chance to summarize our findings so far:</p> <ul> <li><p>We have established that the sample code in the original question produces the expected behavior. <strong>MATLAB passes data as primitives to Java, and Java performs the appropriate autoboxing to Objects.</strong> As pointed out in <a href="https://stackoverflow.com/questions/464216/strange-classes-passed-from-matlab-to-java#466086">Matthew Simoneau's reply</a>, MATLAB explains how it matches its data types to Java data types in the "<a href="http://www.mathworks.com/help/matlab/matlab_external/passing-data-to-a-java-method.html" rel="nofollow noreferrer">Passing Data to a Java Method</a>" section of its documentation. The surprising thing is that a single MATLAB data type may match different Java data types, e.g. <code>logical</code> matches <code>boolean</code>, <code>byte</code>, <code>short</code>, <code>int</code>, <code>long</code>, <code>float</code>, and <code>double</code>, in that order of precedence.</p></li> <li><p>The <code>NoSuchMethodError</code> that the OP initially encountered was caused by the use of a wrong method. This is <a href="https://stackoverflow.com/questions/464216/strange-classes-passed-from-matlab-to-java#466400">no longer a problem</a>. <strong>Using <code>double[]</code> as the method argument works.</strong> </p></li> <li><p><strong>The "strange" class names (<code>[D</code> and <code>[Z</code>) are actually notations used by Java to describe arrays of primitive types.</strong> The API explains the usage in <a href="http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getName()" rel="nofollow noreferrer">Class.getName()</a>.</p></li> </ul> <p>Case closed =)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload