Hello Pierre,
is this too simple?
function outer()
a = 1
function inner()
mprintf("a = %i (inner: a has the value of the outer function)\n", a)
a = resume(a);
endfunction
inner()
mprintf("a = %i (outer: a has got its new inner value of 2\n", a)
endfunction
/Stefan
On
Sorry, I left out a line below (a = 2;)
Hello Pierre,
is this too simple?
function outer()
a = 1
function inner()
mprintf("a = %i (inner: a has the value of the outer function)\n",a)
a = 2;
a = resume(a);
endfunction
inner()
mprintf("a = %i (outer: a has got its new inner
Hi Samuel,
Indeed, the behaviour I seek to reproduce is similar to what could be
done with a global variable. Yet I would avoid to resort to global
variables.
From what I've understand about variables scoping in Scilab
(https://wiki.scilab.org/howto/global%20and%20local%20variables),
Le 17/01/2017 11:46, Pierre Vuillemin a écrit :
I have actually implemented a similar solution (in the previous link)
except that the data are stored in some list. This leads to anonymous
functions that behaves as in Matlab, i.e. the data of the function is
instantiated when the function is
I have actually implemented a similar solution (in the previous link)
except that the data are stored in some list. This leads to anonymous
functions that behaves as in Matlab, i.e. the data of the function is
instantiated when the function is created.
In python, the value of the data 'a' is
A partial solution should be
deff("y=f(x)","a="+sci2exp(a,0)+";y=a*x")
but it may cause numerical problem as a is formatted
Regards
Serge Steer
On 17/01/2017 08:23, Pierre Vuillemin wrote:
Hi all,
I am trying to reproduce the behaviour of anonymous function in Scilab
(see the code in
Hi all,
I am trying to reproduce the behaviour of anonymous function in Scilab
(see the code in lambdaFun here: https://github.com/pivui/scilabTools).
At the moment, it works like in Matlab, for instance:
a = eye(3,3);
lambda 'f(x) = a*x' // the name of the lambda function will be f
a =