getf — defining a function from a file
getf(file-name [,opt])
Scilab string.
optional character string
loaded functions are "compiled" to be more efficient (default)
loaded functions are not "compiled"
loaded functions are "compiled" and prepared for profiling (see profile)
WARNING: this function has been deprecated (see exec as a replacement of getf). getf will be removed in Scilab 5.3
loads one or several functions (see functions
)
defined in the file 'file-name'
. The string
opt='n'
means that the functions are not compiled
(pre-interpreted) when loaded. This can be useful for some debugging
purpose (see comp
). By default, functions are compiled
when loaded (i.e. opt='c'
is used).
In the file a function must begin by a "syntax definition" line as follows:
function [y1,...,yn]=foo(x1,...,xm)
The following lines contain a sequence of scilab instructions.
The "syntax definition" line gives the "full" calling syntax of this
function. The yi
are output variables calculated as
functions of input variables xi
and variables existing
in Scilab when the function is executed. Shorter input or output argument
list may be used.
Many functions may be written in the same file. A function is
terminated by an endfunction
keyword. For compatibility
with previous versions a function may also be terminated by the following
function
keyword or the EOF
mark.
For that reason it is not possible to load function containing nested
function definition using the getf
function.
getf
is an obsolete way for loading functions
into scilab from a file. It is replaced by the function exec. Note that functions in a file should be
terminated by an endfunction
keyword. The
exec
function supposes
opt=='c'
.
To prepare a function for profiling please use the add_profiling function.