next up previous contents index
Next: More Complicated Macros Up: Appendix B: FIT2D Macro Previous: Appendix B: FIT2D Macro


Variables

Macros may be made much more flexible through the use of ``variables''. Internal program variables may be defined using the DEFINE VARIABLE (see Section 15.26, Page [*]). and the VARIABLE commands. Variables are also automatically defined by certain commands e.g. STATISTICS. Variables can be removed by using the UN-DEFINE VARIABLE command (see Section 15.119, Page [*]).

This is similar to the Unix alias command, or the VMS DEFINE or ASSIGN commands. A ``token'' can be defined as a variable and given a value. Once defined, whenever the variable69is encountered it will be substituted by its value70.

This is very powerful, but also very dangerous, and potentially very confusing. Users are recommended to only use unlikely character strings for variables e.g. Start every variable with a hash sign (#), but do not create variables starting with double hash marks (##) as these are reserved for program generated variables. These may be used inside suitably defined macros, but should not be defined by the user. These variable names are CASE SENSITIVE i.e. #in is not the same as #IN.

Certain commands which produce scalar results also define program variables, so that the values may be used interactively and in macros. All such variables start with a double hash sign (##) e.g. the command statistics produces the following variables ##MINIMUM, ##MAXIMUM, ##MEAN, ##TOTAL, ##RMS, ##SIGMA, ##SKEWNESS corresponding to the information output on the screen. By entering the variable as a response to a prompt the program will automatically take the ``value'' of the variable. e.g. The following example will divide each pixel in the ROI by the mean value (assuming ##MEAN has already been defined):

Main menu: ENTER COMMAND [INPUT DATA]:cdivid
DIVISION CONSTANT [1.00000]:##MEAN

This allows much more flexible macros to be written.

Re-defining an existing variable will overwrite its previous value.

A list of the currently defined program variables and their corresponding values (translations) can be obtained with the LIST VARIABLES command.

The creation and usage of simple ``KEYBOARD'' macros is covered in Section 19, Page [*]. Creation and usage of simple GUI macros is covered in Section 8, Page [*].


next up previous contents index
Next: More Complicated Macros Up: Appendix B: FIT2D Macro Previous: Appendix B: FIT2D Macro
Andrew Hammersley
2004-01-09