From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-25-2014 02:24 AM
Hi, I'm trying to find the index of a value in an array, I know there is a VI called "search in a 1D array" but there is my problem : Let's say I'm searching the value 25, and in my measurement serie, there is like 24.998 and 25.001 but no 25, this VI won't find the value 25 even though it went pretty close, so basically I'm trying to inplant a tolerance system which will make able to find with +-3 or 4 precision on the index, do somebody got something for that ?
Thanks for your time
Solved! Go to Solution.
04-25-2014 02:44 AM
I wrote this for a similar job but it could be used for your application. Simply use the attached vi in a loop to check for 'In Range' and return the loop index of the first occurance.
Hope this helps
Ken
04-25-2014 03:03 AM
Thanks for your help, I also found an other solution : I converted the array in I32 (because it was fill in with DBL), so here as soon as I get a 25.xxxxx, it take 25 and the VI find my value 🙂
Your solution might more elegant by the way.
04-25-2014 03:09 AM - edited 04-25-2014 03:12 AM
Warning - converting the array to I32 will return the value if it is in the range 24.500001 to 25.499999 i.e ± 0.5 only hence you have no control over the precision of your search.
By the way, 'Round to nearest' does the same as convert to I32 but keeps it DBL
Regards
Ken
04-25-2014 04:53 AM
No worry I don't expect that much precision and I put some correction term (+-0.5) to be precise in my detection (It does not affect my data and solve my problems) 😉
My goal was to choose a min and a max value, then to detect this 2 values to create an interval, and delete all data out that interval (dynamically), to make a calculation only on these data, but it works now 🙂