[scilab-Users] generation function by function call

Serge Steer Serge.Steer at inria.fr
Mon Aug 29 14:59:25 CEST 2011


You have to use the deff function for that
 deff("[y]=C1(x)","y="+co(1))

Another solution should be to use the exectr function

text=["function [y]=C1(x)"
          "  y="+co(1)
          "endfunction"]
execstr(text)

Serge Steer
INRIA
Le 29/08/2011 11:12, alex G a écrit :
> Sorry for my english, i'm beginner in english ...
>
> Hello,
> I wish convert a string to a function when I press a button graphic. For
> that, I call a function when pressing the button.
>
> I don't have a function in out of my call, why ?
>
> Here is an excerpt of the code I use:
>
> //on souhaite transformer une chaine de caractère en fonction
> co=['4*x(1)+3(2)'];
>
> function re()
>
> if(isempty(co(1))==%F) then
>
> function [y]=C1(x)
> y=evstr(co(1))
> return(evstr(co(1)))
> endfunction
>
> else
>
> function [y]=C1(x)
> y=0;
> endfunction
>
> end;
>
> endfunction 
>
> --
> View this message in context: http://mailinglists.scilab.org/generation-function-by-function-call-tp3292242p3292242.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
>
>   




More information about the users mailing list