Author |
Topic  |
|
Sprenger
Germany
15 Posts |
Posted - 08/23/2016 : 12:10:13 PM
|
Origin 9.3.2-303: Operating System: windows 10 x64
I am pretty new to Origin...
I try find the first occurrence of a value in a column using Index int ind1=Index(200,col(2),1); int ind2=Index(300,col(2),2); ind1=; ind2=;
This works fine if no duplicate values exist in the column. As soon as some values are present in many copies I get the ind1=-2 error message.
What alternative would work here?
Many thanks Frank
|
|
yuki_wu
896 Posts |
|
Sprenger
Germany
15 Posts |
Posted - 08/24/2016 : 03:35:02 AM
|
Dear Yuki, thanks for the reply, unfortunately, LIST cannot be used when the exact value is not present, like INDEX does. I guess I need to use loops like this or is there yet another way?
ga = 800; get col(A2) -e numpoints; for(ll = 1 ; ll <= numpoints ; ll++) { if (Col(A2)[ll] > ga) break; } ll=;
Best Frank |
 |
|
yuki_wu
896 Posts |
Posted - 08/24/2016 : 03:58:27 AM
|
Hi Frank,
For List() function, if there is no match, the function returns 0.
FYI, List() function makes an "exact" comparison using the equal (==) operator. It means that the function returns the index number in a dataset where a specified value first occurs.
Yuki OriginLab |
 |
|
AmandaLu
439 Posts |
Posted - 08/24/2016 : 05:04:31 AM
|
Hi
Please try vfind X-Function: dataset ds; vfind ix:=col(2) value:=300 tol:=5 ox:=ds; ds[1]=;
And here is the detailed document of vfind function:
http://www.originlab.com/doc/X-Function/ref/vfind
Thanks, Amanda OriginLab Technical Service
|
 |
|
|
Topic  |
|