Re: [Scilab-users] Different results inside a function and in the console

2019-02-01 Thread Izabela Wójcik-Grząba
Thank you Federico. I did some tests to check what can be wrong but I 
failed and till this moment I don't know what was wrong. Fortunately I 
did some reorganisation in my code and now it works fine. Sorry for 
bothering but after many failures in tests I was really frustrated.


Have a nice day,
Iza





W dniu 31.01.2019 22:40, Federico Miyara napisał(a):

Izabela,

It is difficult to tell what's happening without seeing the function
code.

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.

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.

Regards,

Federico Miyara

On 31/01/2019 15:06, Izabela Wójcik-Grząba wrote:


Hello,

I have a strange problem with simple calculations which are done
inside a function. I will put here exact data and formula:

p_x=

0.
0.
0.
0.
0.
0.

p_x_pocz=

0.
0.
0.
0.
0.
0.

reakcje=

1.   1.03   2.1   -2.11.   2.
4.   0.92   2.45  -2.45   5.   2.

luzne_nr=

1.
4.

u=

4.6
3.6
-2.4
-4.4
-1.4

l_poziom=

5.1
4.56



p_x(reakcje(:,5))=p_x_pocz(reakcje(:,5))+u(luzne_nr).*reakcje(:,2)./l_poziom;



When it is calculated inside the function I get a result:

p_x=

0.93
0.
0.
0.
-0.89

When I use the same data and formula in the Console I get a correct
result:

p_x  =

0.93
0.
0.
0.
-0.89
0.

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.

Has andybody any idea what can be wrong? Am I missing something?

Thanks for any help.

Kind regards,
Iza
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


-

 [1]

 El software de antivirus Avast ha analizado este correo electrónico
en busca de virus.
www.avast.com [1]



Links:
--
[1] https://www.avast.com/antivirus
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Different results inside a function and in the console

2019-01-31 Thread Federico Miyara


Izabela,

It is difficult to tell what's happening without seeing the function code.

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.


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.


Regards,

Federico Miyara




On 31/01/2019 15:06, Izabela Wójcik-Grząba wrote:

Hello,

I have a strange problem with simple calculations which are done 
inside a function. I will put here exact data and formula:


p_x=

   0.
   0.
   0.
   0.
   0.
   0.

 p_x_pocz=

   0.
   0.
   0.
   0.
   0.
   0.

 reakcje=

   1.   1.03   2.1   -2.11.   2.
   4.   0.92   2.45  -2.45   5.   2.

 luzne_nr=

   1.
   4.

 u=

   4.6
   3.6
  -2.4
  -4.4
  -1.4

 l_poziom=

   5.1
   4.56

p_x(reakcje(:,5))=p_x_pocz(reakcje(:,5))+u(luzne_nr).*reakcje(:,2)./l_poziom; 



When it is calculated inside the function I get a result:

p_x=

   0.93
   0.
   0.
   0.
  -0.89

When I use the same data and formula in the Console I get a correct 
result:


p_x  =

   0.93
   0.
   0.
   0.
  -0.89
   0.

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.


Has andybody any idea what can be wrong? Am I missing something?

Thanks for any help.

Kind regards,
Iza
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users





---
El software de antivirus Avast ha analizado este correo electrónico en busca de 
virus.
https://www.avast.com/antivirus
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users