[scilab-Users] feval an external function
Mathieu Dubois
mathieu.dubois at limsi.fr
Sat Jul 10 13:08:06 CEST 2010
Hello Peter,
> In the main script I call a function 'foo' (which is made known to the
> main script by exec('foo.sci'))
> which takes another function 'bar' and some arguments as its arguments.
>
> Inside the body of 'foo' the function 'bar' is evaluated by
> 'feval(arguments,'bar')'...
>
Are you sure that this what you want to do? Under scilab feval is used
to evaluate an external function on several arguments (see help page).
This is different than matlab© function feval.
> Unfortunately the interpreter cannot find the function 'bar' (although
> that function is also made known
> to the main script). Error message: feval: entry point bar not found
> in predefined tables or link table.
>
> Is there a way to execute the function 'bar' inside the function 'foo'?
>
If I understand your problem, you want to pass a function (bar) as an
argument to another function (foo) and evaluate it, right?
The good new is that scilab functions are variables so you can pass the
function bar as an argument (without quotes). Let's say that the
argument name is bar_function. Then you can simply write (inside foo)
bar_function(args).
See chapter 6 of "An Introduction to Scilab from a Matlab User's Point
of View" by Eike Rietsch on scilab website
(http://www.scilab.org/en/support/documentation/community).
I have attached a dummy example (where the function to call is called
bars to avoid erasing the predefined bar)
HTH,
Mathieu
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_bars.sce
URL: <https://lists.scilab.org/pipermail/users/attachments/20100710/5373d0e7/attachment.ksh>
More information about the users
mailing list