OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis                           
 

2.2.33 vfind

Brief Information

Find all vector elements equal to a specified value

Command Line Usage

1. vfind ix:=col(1) value:=3 ox:=col(2);

2. vfind ix:=col(3) value:=1.25 ox:=col(4) tol:=0.05;

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Dataset to find value ix

Input

vector

<active>

Specifies the input vector.

Value to find value

Input

double

0

Specifies the value to find in the input vector,

Indices of all found value ox

Output

vector

<new>

Specifies the output vector to save the indices of all found elements.

Tolerance tol

Input

double

0

Specifies the tolerance used in the search.

Description

This function find all vector elements whose values are equal to a specified value.

Examples

  • Code Sample
// 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

 

© OriginLab Corporation. All rights reserved.