Xindex
Description
The xindex function returns the index number of the cell in the X dataset associated with vd, where the cell value is closest to specified x.
Syntax
xindex(double x, vector vd, [, int option])
Parameters
x
- is any real number.
vd
- is the vector data.
-
Requirements:
- vd must be a designated Y dataset.
- The Y dataset name must correspond to an actual Y dataset.
- The associated X dataset must be sorted in ascending order.
option
-
Contains three options:
- 0 (default) : Equal or closest from left
- 1 : Equal or closest from right
- 2 : Equal or closest, left or right
Note: The 3rd argument (option) has been available since Origin 8.0 SR3. left means earlier in the dataset (lower row number) and right means later in the dataset (higher row number).
Return
Returns the index number of the cell in the X dataset associated with vd, where the cell value is closest to x.
Examples
range rb = [Book1]Sheet1!col(B); ix=xindex(4.5,rb);
See Also
LabTalk:Xof (function), LabTalk:Xindex1 (function), LabTalk:Xvalue (function), LabTalk:Idx_(function)