[scilab-Users] Strange behavior
Jacco Kramer
jacco.kramer at teb.nl
Tue Nov 4 09:58:09 CET 2008
You defined your function to use the variables a and b. If you don't
pass these to the function, it will use the environment a and b. Since
you filled them with 7 and -1 the step before it, it uses them as input.
Now, when you call it without arguments, and without defining multiple
outputs it just does the first output (x=a+b), which is 7+-1 = 6.
I'm not sure I explained correctly and clearly, but it's something along
these lines.
-----Oorspronkelijk bericht-----
Van: Maki 1sy8 [mailto:debian1sy8 at gmail.com]
Verzonden: maandag 3 november 2008 1:31
Aan: Scilab
Onderwerp: [scilab-Users] Strange behavior
Hi all.
With the following function I found in the function help
function [x,y]=myfct(a,b)
x=a+b
y=a-b
endfunction
I tried
-->c=3;d=4;
-->[a, b]= myfct(c, d)
b =
- 1.
a =
7.
Why the following ???
-->myfct
ans =
6.
More information about the users
mailing list