Using the #DEFINE Statement from the Command Line


Another way to define a macro is to use the #define statement from the DADiSP command line. The #define command has the following format:


#define name(arg1, arg2, ... , argn) expansion





A string (up to 15 characters long).


Macro arguments (n £ 10).


An equation incorporating the arguments. This equation is evaluated when the macro is called.


A macro definition is limited to one line. For example, you could create a macro called REMOFFSET which would remove the DC offset from a series:


#define remoffset(s) (s)-mean(s)


where S is the argument for any expression evaluating to a series. Once you've defined REMOFFSET, you can then use the macro as a valid Worksheet function as in:




Macros do not have to take arguments. You might define a macro to set the Window colors:


#define myway wincolor(black,green)


Simply type MYWAY to set the color scheme for the window.

You could also define a constant macro:


#define siggain 10