<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Bug reported and the workaround works. Thanks!<br><br><div><hr id="stopSpelling">Date: Fri, 23 Jan 2015 08:52:09 +0100<br>From: calixte.denizet@scilab-enterprises.com<br>To: users@lists.scilab.org<br>Subject: Re: [Scilab-users] Problem using jarray (Scilab 5.5.1)<br><br>
  
    
  
  
    <div class="ecxmoz-cite-prefix">On 23/01/2015 07:39, Joo Cat wrote:<br>
    </div>
    <blockquote cite="mid:BLU182-W18146D572701F6BF1BFBCAC1360@phx.gbl">
      <div dir="ltr">
        <style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
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">
      <div dir="ltr">
        <div dir="ltr"><br>
        </div>
      </div>
      <br>
      <fieldset class="ecxmimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
users mailing list
<a class="ecxmoz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="ecxmoz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="ecxmoz-signature">-- 
Calixte Denizet
Software Development Engineer
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
<a class="ecxmoz-txt-link-freetext" href="http://www.scilab-enterprises.com" target="_blank">http://www.scilab-enterprises.com</a></pre>
  

<br>_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users</div>                                        </div></body>
</html>