LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find the nearlest value in 1-D array ?

Hi.. everybody..
I need to seperate the raw data(1-D) into 2 group of array by the center value and then make the average value in each array. But I also still have the problem about if the center value is not the same of some value in the 1-D array. I cannot use the split function.

"How to find the nearlest value to the center point that I calculated, in the 1-D array ?"

Thanks a lot for anybody help 🙂
0 Kudos
Message 1 of 5
(2,998 Views)
In a general sense, since I'm not sure what your data values are or how far away your calculated center is from the true value, I would do it one of two ways:
1) Use a threshold value and scan the array until the threshold is reached (assumes constantly increasing values in the array).
2) Use either a) round to nearest integer b) round to + Infinity (round up) or c) round to - infinity (round down). If you don't have decimal values, you'll have to devide the values by a power of 10.


2006 Ultimate LabVIEW G-eek.

Message 2 of 5
(2,998 Views)
> I need to seperate the raw data(1-D) into 2 group of array by the
> center value and then make the average value in each array. But I also
> still have the problem about if the center value is not the same of
> some value in the 1-D array. I cannot use the split function.
>
> "How to find the nearlest value to the center point that I calculated,
> in the 1-D array ?"
>

I'm not sure what you are meaning by the center point. One
interpretation is that the ordering of the data is unimportant. Sort
the array, then search use threshold. If order is important, use the
trick where you place the index in a cluster with the original value.
Sort by the value, and the index tells you where each element was in the
original array.

If none of this helps, p
lease rephrase your question and maybe it will
be more clear what you are looking to do.

Greg McKaskle
Message 3 of 5
(2,998 Views)
Thanks a lot Jonnie.

It is perfect. I success with threshold array.:)
0 Kudos
Message 4 of 5
(2,998 Views)
Thanks McKaske..

The threshold works fine..
0 Kudos
Message 5 of 5
(2,998 Views)