Scilab Function
Last update : 07/09/2007

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

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 `exec` function. Note that functions in a file should be terminated by an `endfunction` keyword. The `exec` function supposes `opt=='c'`.

### Examples

    getf('SCI/macros/xdess/plot.sci')

    getf SCI/macros/xdess/plot.sci

### See Also

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