octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48790] javaArray('double',1)


From: Ernst Reissner
Subject: [Octave-bug-tracker] [bug #48790] javaArray('double',1)
Date: Fri, 19 Aug 2016 08:23:44 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0

Follow-up Comment #4, bug #48790 (project octave):

Nonono!!! 

The site you cite, 
 https://www.mathworks.com/help/matlab/ref/javaarray.html, 
clearly says 

ObjArr = javaArray(PackageName.ClassName,x1,...,xN) constructs an empty Java®
array object for objects of the specified PackageName.ClassName class.

That is clear and that is not what is done in Octave. 
What you cite: 
> To create an array of primitive Java types, create an array of the
equivalent MATLAB type, shown in the Conversion of MATLAB Types to Java Types
table. See Conversion of MATLAB Argument Data. 

is a tip only and it says nothing about the return type of javaArray, right? 
The tip is not bad, but not always applicable, 
as seen in you other link, 

https://www.mathworks.com/matlabcentral/answers/96483-how-can-i-pass-a-ragged-array-of-java-primitive-types-to-a-java-function-from-matlab

It is about ragged arrays, which are supported by Java but not by Octave. 

By the way, although maybe 
> The ability to create Java primitive types is not available in MATLAB. 

Octave HAS the ability to create arrays of primitive types. 
It is an undocumented feature, that instead of a string, 
one can pass a class and in particular Double.TYPE 
as I pointed out below. 
Maybe matlab can do so as well. 


Also: 
javaObject('java.lang.Double',42)
 yields 

ans =

<Java object: java.lang.Double>


not just 42 for that reason. 


A re

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48790>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]