188.8.131.52.1.4 Arithmetic Statement
The arithmetic statement takes the general form:
dataObject1 operator dataObject2;
- dataObject1 is a dataset or a numeric variable.
- dataObject2 is a dataset, variable, or a constant.
- operator can be +, -, *, /, or ^.
The result of the calculation is put into dataObject1. Note that dataObject1 cannot be a function. For example, col(3) + 25 is an illegal usage of this statement form.
The following examples illustrate different forms of arithmetic statements:
If myData is a dataset, this divides each value in myData by 10.
myData / 10;
Subtract otherData from myData, and put the result into myData. Both datasets must be Y or Z datasets (see Note).
myData - otherData;
If A is a variable, increment A by 1. If A is a dataset, increment each value in A by 1.
A + 1;
Note: There is a difference between using datasets in arithmetic statements versus using datasets in assignment statements. For example, data1_b + data2_b is computed quite differently from data1_b = data1_b + data2_b. The latter case yields the true point-by-point sum without regard to the two datasets' respective X-values. The former statement, data1_b + data2_b, adds the two data sets as if each were a curve in the XY-plane. If therefore, data1_b and data2_b have different associated X-values, one of the two series will require interpolation. In this event, Origin interpolates based on the first dataset's (data1_b in this case) X-values.