#DEFFUN

Purpose:

Defines a single line DADiSP function.

Syntax:

#DEFFUN name(arg1, arg2, ..., argn) statement

 

name          -  A string up to 15 characters long naming the function.

argn           -  Optional. Any argument being passed to the function.

statement  -  The body of the function. An equation or expression incorporating the function arguments.

Example:

#deffun normal(s) s/max(s)

 

defines a function which normalizes a series by its maximum value.

 

W1: {1,2,3,4,5}

normal(W1)

 

returns the series {0.2, 0.4, 0.6, 0.8, 1.0}.

Example:

#deffun minmax max-min

 

defines a function minmax equal to the range of the data.

Remarks:

SPL function names are not case sensitive.

 

If a function does not accept arguments, the argument list is omitted. Multi-line functions must be specified in separate ASCII files.

 

You can use #DEFFUN to redefine existing functions. Functions are defined and saved with the Worksheet.

 

Use SPLWRITE to write functions to a file.

 

An SPL function normally resides in a text file with extension .SPL where the filename is the same as the function name. See the .SPL directory for examples.

See Also:

ALLFUNCTIONS

DELALLFUNCTIONS

DELFUN

FUNCTIONS

SPLREAD

SPLWRITE