Trouble with the function parser

Teodor Calin tedcn02 at yahoo.com
Tue Jan 8 11:19:08 CET 2008


Okay, here's my  complaint:


I write this code:
"
clear;
 
function [x,y]=myfct(a,b)
x=a+b
y=a-b
endfunction

[x,y]=myfct(3,2)

//////////////////////////////////

for k = 1:21 do

  function [x,y]=myfct2(a,b)
      x=a+b
      y=a-b
  endfunction

  [u,v] = myfct2(k, k+1)
  
end
"


And I get this result:
"
y  =

    1.
 x  =

    5.
=a-b
 !--error 2
invalid factor
at line       3 of function myfct2 called by :
  endfunction
line    20 of exec file called by :
exec("S:/Depannage.sci");
in  execstr instruction    called by : 
"


In other words, defining functions with more than one return variables inside loops
does not work.
By the way, what (in the *#!§^$) does 'invalid factor' mean ?


Also, I'm really mad about this, because if I write

"
for k = 1:21 do

  function y=myfct3(a,b)
      y=a-b
  endfunction

  u = myfct3(k, k+1)
  
end
"



this works perfectly well. So I expected it to work for the above too !

So, is there a way to circumvent this ?

Thanks in advance

Teodor




      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20080108/52bd494c/attachment.htm>


More information about the users mailing list