[Scilab-users] Problem using jarray (Scilab 5.5.1)

Joo Cat joodlink at hotmail.com
Fri Jan 23 07:39:21 CET 2015




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 at 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 at 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!



 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150123/99bb67ae/attachment.htm>


More information about the users mailing list