Sun 26 May 2013 10:54:01 PM UTC, comment #3:
yes
seems really valuable.
I cite:
<cite>
Java Objects
When a method call returns Java objects, MATLAB leaves them in their original form. They remain as Java objects so you can continue to use them to interact with other Java methods.
The only exception to this is when the method returns data of type java.lang.Object.
</cite>
So this means that auto(un)boxing of RETURN VALUES
is not conform with matlab.
Of course, object means really a subclass of java.lang.Object.
Not to mix up with using the method double
<cite>
Converting to the MATLAB double Type
Using the double function in MATLAB, you can convert any Java object or array of objects to the MATLAB double type. The action taken by the double function depends on the class of the object you specify:
If the object is an instance of a numeric class (java.lang.Number or one of the classes that inherit from that class), MATLAB uses a preset conversion algorithm to convert the object to a MATLAB double.
If the object is not an instance of a numeric class, MATLAB checks the class definition to see if it implements a method called toDouble. MATLAB uses toDouble to perform its conversion of Java objects to the MATLAB double type. If such a method is implemented for this class, MATLAB executes it to perform the conversion.
.....
</cite>
In by case i have the problem with a class extending java.lang.Number.
I have the impression that the method double is invoked
to convert, which is not allowed.
By the way, i do not define method toDouble.
|