<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 23/01/2015 07:39, Joo Cat wrote:<br>
</div>
<blockquote cite="mid:BLU182-W18146D572701F6BF1BFBCAC1360@phx.gbl"
type="cite">
<div dir="ltr">
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div dir="ltr">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:<br>
a = jarray("java.lang.Double",3,1)<br>
a(1) = [1 2 3]<br>
a(2) = [4 5]<br>
a(3) = 6<br>
<br>
Next, I attempted to create a primitive double array instead:<br>
b = jarray("double",3,1)<br>
b(1) = [1 2 3]<br>
b(2) = [4 5]<br>
b(3) = 6<br>
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:<br>
!--error 999 <br>
%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<br>
at
org.scilab.modules.external_objects_java.ScilabJavaArray.set(Unknown
Source)<br>
at
org.scilab.modules.external_objects_java.ScilabJavaObject.insert(Unknown
Source)<br>
Array [[D@dbe4e5 cannot contain object which is an instance of
class java.lang.Double<br>
at
org.scilab.modules.external_objects_java.ScilabJavaArray.set(Unknown
Source)<br>
at
org.scilab.modules.external_objects_java.ScilabJavaObject.insert(Unknown
Source)<br>
<br>
It looks like it considers scalar values as Double type and
not the primitive double. Is there a way to overcome this?
Thanks!<br>
<br>
</div>
</div>
</blockquote>
<br>
Hi,<br>
<br>
It is a bug so please report it at bugzilla.scilab.org.<br>
<br>
A temporary workaround:<br>
c=jarray("double",1);c(1)=6;<br>
b = jarray("double",3,1)<br>
b(3)=c<br>
<br>
Best regards<br>
<br>
Calixte<br>
<br>
<blockquote cite="mid:BLU182-W18146D572701F6BF1BFBCAC1360@phx.gbl"
type="cite">
<div dir="ltr">
<div dir="ltr"><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Calixte Denizet
Software Development Engineer
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
<a class="moz-txt-link-freetext" href="http://www.scilab-enterprises.com">http://www.scilab-enterprises.com</a></pre>
</body>
</html>