Name

getf — defining a function from a file

Calling Sequence

getf(file-name [,opt])

Parameters

filename

Scilab string.

opt

optional character string

"c"

loaded functions are "compiled" to be more efficient (default)

"n"

loaded functions are not "compiled"

"p"

loaded functions are "compiled" and prepared for profiling (see profile)

Description

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.

Examples

getf('SCI/modules/graphics/macros/plot.sci')

getf SCI/modules/graphics/macros/plot.sci
 
  

See Also

functions, function, genlib, getd, exec, edit, comp, add_profiling