On 23/01/2015 07:39, Joo Cat wrote:
I was attempting to create a jagged array in Scilab to be sent to a Java instance. At first, I created a Double class array and had no problems:
a = jarray("java.lang.Double",3,1)
a(1) = [1 2 3]
a(2) = [4 5]
a(3) = 6

Next, I attempted to create a primitive double array instead:
b = jarray("double",3,1)
b(1) = [1 2 3]
b(2) = [4 5]
b(3) = 6
I had no problem with the first few lines. The problem occured at b(3) = 6 when I attempted to assign a single element value. I got this error:
!--error 999
%s_i__EObj: An error occurred: Exception when calling Java method : Array [[D@dbe4e5 cannot contain object which is an instance of class java.lang.Double at org.scilab.modules.external_objects_java.ScilabJavaArray.set(Unknown Source) at org.scilab.modules.external_objects_java.ScilabJavaObject.insert(Unknown Source) Array [[D@dbe4e5 cannot contain object which is an instance of class java.lang.Double at org.scilab.modules.external_objects_java.ScilabJavaArray.set(Unknown Source) at org.scilab.modules.external_objects_java.ScilabJavaObject.insert(Unknown Source)

It looks like it considers scalar values as Double type and not the primitive double. Is there a way to overcome this? Thanks!


Hi,

It is a bug so please report it at bugzilla.scilab.org.

A temporary workaround:
c=jarray("double",1);c(1)=6;
b = jarray("double",3,1)
b(3)=c

Best regards

Calixte




_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users


--
Calixte Denizet
Software Development Engineer
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
http://www.scilab-enterprises.com

_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to