- Scilab help
- Scilab
- Scilab keywords
- TMPDIR
- abort
- add_demo
- argn
- banner
- boolean
- break
- clear
- clearfun
- clearglobal
- comp
- continue
- debug
- delbpt
- dispbpt
- edit
- errcatch
- errclear
- error
- error_table
- exists
- exit
- external
- extraction
- format
- funcprot
- funptr
- getdebuginfo
- getmd5
- getmemory
- getmodules
- getos
- getscilabmode
- getshell
- getvariablesonstack
- getversion
- gstacksize
- ieee
- insertion
- intppty
- inv_coeff
- iserror
- isglobal
- lasterror
- macr2lst
- macr2tree
- matrices
- matrix
- mode
- mtlb_mode
- names
- newfun
- null
- pause
- perl
- poly
- predef
- quit
- rational
- readgateway
- resume
- sciargs
- scilab
- setbpt
- stacksize
- startup
- symbols
- testmatrix
- type
- typename
- user
- varn
- ver
- warning
- what
- where
- whereami
- who
- who_user
- whos
- with_atlas
- with_javasci
- with_macros_source
- with_module
- with_pvm
- with_texmacs
- with_tk

Please note that the recommended version of Scilab is 6.0.1. This page might be outdated.

See the recommended documentation of this function

# external

Scilab Object, external function or routine

### Description

External function or routine for use with specific commands.

An "external" is a function or routine which is used as an argument
of some high-level primitives (such as `ode`

, `optim`

, `schur`

...).

The calling sequence of the external (function or routine) is imposed by the high-level primitive which sets the arguments of the external.

For example the external function `costfunc`

is an argument of the `optim`

primitive. Its calling sequence must be: `[f,g,ind]=costfunc(x,ind)`

and
`optim`

(the high-level optimization primitive) is invoked as follows:

optim(costfunc,...)

Here `costfunc`

(the cost function to be minimized by the primitive `optim`

)
evaluates `f=f(x)`

and `g=`

gradient of `f`

at `x`

(`ind`

is an integer. Its use is precised in the `optim`

help).

If other values are needed by the external function these variables can be defined in its environment. Also, they can be put in a list. For example,the external function

[f,g,ind]=costfunc(x,ind,a,b,c)

is valid for `optim`

if the external is `list(costfunc,a,b,c)`

and
the call to `optim`

is then:

An external can also be a Fortran or C routine : this is convenient to speed up the computations.

The name of the routine is given to the high-level primitive as a character string. The calling sequence of the routine is also imposed.

External Fortran or C routines can also be dynamically linked (see `link`

)

## Comments

Add a comment:Please login to comment this page.