Math Expression

Use the Project > Scripting > Math Expression menu option (MATH GX) to apply a mathematical expression to channels in a database.

Math Expression dialog options

Expression

Expression string.

Script Parameter: MATH.EXP

Application Notes

Mathematical expressions used by the MATH GX are the same as the database expressions described in the Rules for Math Expressions help topic except that you must specify the place to put the result of the expression by providing a channel name on the left side of the '=' sign. For example, the following expression adds two channels 'ADATA' and 'BDATA' together and places the result in a channel named 'C':

 C=ADATA+BDATA;

Expressions should end with a ';' character. You may specify more than one expression at a time by separating expressions using the semicolon. For example, the following expression adds two channels, then squares the result and places it in channel 'D':

 C=ADATA+BDATA;D=C*C;

Note that multiple expressions are evaluated in order, left to right.

All channel names used in an expression must exist in the database before the expression can be applied. You may use temporary variables in expressions instead of a channel name. A temporary variable is any name preceded by the '@' character. For example, if you had no need for the 'C' channel other than to hold the result of the summation, you could have used a temporary variable @SUM as follows:

 @SUM=ADATA+BDATA;D=@SUM*@SUM;

We recommend that you use temporary variables rather than actual channels whenever possible. Every channel that appears in an expression requires a certain amount of system memory to evaluate the expression (currently 4096 bytes per channel).On systems with limited memory, complex expressions may exhaust the available memory. A temporary variable only requires 8-bytes per variable.