05-12-2009 04:25 AM
Hi.
I have a bunch of data. Let say 48000 elements. And from it, I try to search, one element using 'Search 1D array' .
However it doesn't work as wanted.
I put an indicator on output of the 'Search 1D array' , but the value always "-1".
Anybody could help me. Please refer to my VI as reference. The 'Search 1D array' is used under case structure of "Synchronize Pressure and Alpha".
Thanks.
Firdaus
Solved! Go to Solution.
05-12-2009 04:38 AM
hi,
i can not open ur vi as i have labview8.5. It should find the element from array if ur array has that element. try this..devide or split array into two and then search...or instead of using search 1D array u can use for loop and search array element separately.
GAK
05-12-2009 04:45 AM
Firdaus,
the origin of your array is a DAQ channel and the numeric type is DBL. Never ever compare DBL to "equal", but that is what "Search 1D Array" does. So either convert your data to integer first or write another search-algorithm which is capable to search for ranges....
hope this helps,
Norbert
05-12-2009 04:50 AM
hi norbert,
can you tell me why you should "Never ever compare DBL to "equal", ? I am new to LabView.
05-12-2009 04:51 AM
You do a search on a floating point number, presumably the value is no 0 but something slightly different than zero. This is normal for any computation system, I suggest you to use an In Range function with -0.00001 and 0.00001 as limits and than search for the first value that is actual In Range.
Ton
05-12-2009 06:15 AM
Hi Norbert, Gak and TonP,
Thank you for answering my question.
Gak,
I dont know how to convert to version of 8.5.
Norbert,
I already change to integer, but it still doesnt works.
TonP,
I would like to know a bit idea on how to use this function.
You suggest me to use 'In Range and Coerce' function right?
If that so, i should set the upper limit as 0.00001, lower limit as -0.00001 and the 'x' should be the value needed.
While the output 'Coerced (x)' is then connected to the 'Search 1D array'? Is this what you mean?
Thanks.
Firdaus
05-12-2009 09:16 AM
Firdaus,
could you please post your updated code?
Norbert
05-12-2009 09:23 AM
Hi Norbert,
Please find the attachment below.
By the way, could you give one example on how to change the array from DAQ into integeter. Because, as from your suggestion, I simply use converter 'To Unsigned Byte Integer'.
Firdaus
05-12-2009 09:59 AM - edited 05-12-2009 10:00 AM
No. You are not using the In Range and the Search 1D Array correctly at all. You need to replace the Search 1D Array with the In Range function inside a loop and you do not use the Coerce output at all.
Using your example, you would add the +/- 1e-5 to the .0253858. These values are the upper and lower limits. A quick example is shown below.
05-12-2009 10:12 AM
Hi Dennis,
Thanks for your help.
I will try it now.
Firdaus