DADiSP Worksheet Functions > Function Categories > Macro and Command File Functions > #DEFINE

 

#DEFINE

Purpose:

Defines a macro.

Syntax:

#DEFINE name(arg1, arg2, ..., argN) formula

name

-

A string up to 15 characters, the name of the macro.

argN

-

Optional. Zero or more arguments to pass to the macro expression.

formula

-

The macro expansion incorporating those arguments and evaluating to a real, string, series, or table.

Example:

#define autocor(s) conv(s, reverse(s))/(2*sersize(s))

 

defines a macro which performs an auto-correlation of a series.

 

W1: gsin(128, 1/128, 4.0)

autocor(W1)

 

calculates the auto-correlation of the sine wave.

Remarks:

#DEFINE can redefine existing macros.

 

Macros are defined and saved with the Worksheet. Use MACWRITE to write macros to a file.

 

See DEFMACRO to dynamically define a macro within an SPL routine.

 

The maximum length of a macro name is 63 characters.

See Also:

#DEFAULT

#UNDEFALL

#UNDEFINE

__FILE__

__FUNC__

__LINE__

DEFMACRO

MACREAD

MACROS

MACWRITE