Find all vector elements equal to a specified value
1. vfind ix:=col(1) value:=3 ox:=col(2);
2. vfind ix:=col(3) value:=1.25 ox:=col(4) tol:=0.05;
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Dataset to find value | ix |
Input vector |
|
Specifies the input vector. |
Value to find | value |
Input double |
|
Specifies the value to find in the input vector, |
Indices of all found value | ox |
Output vector |
|
Specifies the output vector to save the indices of all found elements. |
Tolerance | tol |
Input double |
|
Specifies the tolerance used in the search. |
This function find all vector elements whose values are equal to a specified value.
// To find the rows where the ramp drops back, we can calculate the difference of adjacent rows // and then this problem reduces to finding all places where "0" appears in the difference column. 1. Create a new book and set col(1) some block data. 2. Set the col(2) according to the sign of the difference of col(1). 3. Find the positions of "0" which are the positions ramp drops back. */ // create the block data newbook; col(1) = {1:10}; copydata col(1)[1:10] col(1)[11:20]; copydata col(1)[1:20] col(1)[21:40]; // set the col(2) according to the sign of the difference of col(1) col(2) = diff(col(1))>0 ? 1 : 0; // find the positions of "0", which indicate where the ramp drops back vfind 2 0 3;
Keywords:match, tolerance