<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <font face="Courier New, Courier, monospace">Izabela,<br>
      <br>
      It is difficult to tell what's happening without seeing the function
      code.<br>
      <br>
      However, it appears as if variable p_x were cleared or redefined
      to have only 5 components prior to the assignment of two of its
      elements (those with indices 1 and 5) when executing the formula.<br>
      <br>
      What I would do is to create a new function removing all function
      code not related to the problem, trying to track what happens to
      p_x before applying the formula.<br>
      <br>
      Regards,  <br>
      <br>
      Federico Miyara<br>
      <br>
      <br>
      <br>
      <br>
      On</font> 31/01/2019 15:06, Izabela Wójcik-Grząba wrote:<br>
    <blockquote cite="mid:2c4f82fd22fb913acd2b1043e3d54084@il.pw.edu.pl"
      type="cite">Hello,
      <br>
      <br>
      I have a strange problem with simple calculations which are done
      inside a function. I will put here exact data and formula:
      <br>
      <br>
      p_x=
      <br>
      <br>
         0.
      <br>
         0.
      <br>
         0.
      <br>
         0.
      <br>
         0.
      <br>
         0.
      <br>
      <br>
       p_x_pocz=
      <br>
      <br>
         0.
      <br>
         0.
      <br>
         0.
      <br>
         0.
      <br>
         0.
      <br>
         0.
      <br>
      <br>
       reakcje=
      <br>
      <br>
         1.   1.03   2.1   -2.1    1.   2.
      <br>
         4.   0.92   2.45  -2.45   5.   2.
      <br>
      <br>
       luzne_nr=
      <br>
      <br>
         1.
      <br>
         4.
      <br>
      <br>
       u=
      <br>
      <br>
         4.6
      <br>
         3.6
      <br>
        -2.4
      <br>
        -4.4
      <br>
        -1.4
      <br>
      <br>
       l_poziom=
      <br>
      <br>
         5.1
      <br>
         4.56
      <br>
      <br>
p_x(reakcje(:,5))=p_x_pocz(reakcje(:,5))+u(luzne_nr).*reakcje(:,2)./l_poziom;
      <br>
      <br>
      When it is calculated inside the function I get a result:
      <br>
      <br>
      p_x=
      <br>
      <br>
         0.93
      <br>
         0.
      <br>
         0.
      <br>
         0.
      <br>
        -0.89
      <br>
      <br>
      When I use the same data and formula in the Console I get a
      correct result:
      <br>
      <br>
      p_x  =
      <br>
      <br>
         0.93
      <br>
         0.
      <br>
         0.
      <br>
         0.
      <br>
        -0.89
      <br>
         0.
      <br>
      <br>
      To check the input values I displayed the input data before the
      formula in the function with disp, and then I used these values
      for calculations in the Console.
      <br>
      <br>
      Has andybody any idea what can be wrong? Am I missing something?
      <br>
      <br>
      Thanks for any help.
      <br>
      <br>
      Kind regards,
      <br>
      Iza
      <br>
      _______________________________________________
      <br>
      users mailing list
      <br>
      <a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
      <br>
      <a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
      <br>
      <br>
    </blockquote>
    <br>
  <div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2">
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
        <tr>
                <td style='border:none;padding:0px 15px 0px 8px'>
                        <a href="https://www.avast.com/antivirus">
                                <img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" alt="Avast logo" />
                        </a>
                </td>
                <td>
                        <p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
                                El software de antivirus Avast ha analizado este correo electrónico en busca de virus.
                                <br><a href="https://www.avast.com/antivirus">www.avast.com</a>
                        </p>
                </td>
        </tr>
</table>
<br />
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>