[Scilab-users] Get back the name of a function given as argument

Samuel Gougeon sgougeon at free.fr
Mon Oct 12 21:02:01 CEST 2015


Hi Pierre,

Le 12/10/2015 16:46, Pierre Vuillemin a écrit :
> Hi all,
>
> I am building some optimisation tools, and in this context, I was 
> wondering if it was possible to get back the name of a function given 
> as argument of another function.
>
> More specifically, consider the function 'fun' defined as
>
> deff('[f,g] = fun(x)','f = x^2;g = 2*x');
>
> and an optimisation routine "minimize" which first argument is a 
> function.
>
> Is there a way to get back the name of the function "fun" when calling 
> "minimize(fun)" ?

I am afraid that, with 5.5.2,  you have to use something like 
minimize("thefun") instead, with

function argout = minimize(fun,...)
     execstr("fun="+fun);
    ...
endfunction

Samuel




More information about the users mailing list