LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Splitting Array of doubles into bins using the floor function

Solved!
Go to solution

Hi all, I have an array of double data. I want to split this array into three categories: the ones where the floor of the data is less than 40, the ones where the floor is from 40-69, and the ones where the floor is 70 or greater. Then on the middle group I want to further bin the data by each integer, so you get one group that has the floor going to 50, on with the floor at 51, one with the floor at 40, etc. 

 

any idea what that would look like?

0 Kudos
Message 1 of 8
(3,578 Views)

A while loop, some conditional indexing terminals and some "In Range and Coerce" functions?

0 Kudos
Message 2 of 8
(3,539 Views)
Solution
Accepted by topic author ijustlovemath

A For loop and Threshold 1D array

Basycally it is hystogram function (number of elements in each group). 

I do not know how you want to organize your groups, so it is just counting elements in each group. 

 

split array.png

Message 3 of 8
(3,492 Views)

I ended up doing something very similar:

 

Never seen Threhold 1D array used before though, thanks for introducing me to it!

0 Kudos
Message 4 of 8
(3,488 Views)

So you wanted the histogram data? Then just use the "General Histogram" function! 😃

 

I thought you wanted the actual elements, no only the count.

In that case I would do like this (note that you can right click on the "In range..." functions and select whether the limits should be included)

 

histogram sieve.png

0 Kudos
Message 5 of 8
(3,481 Views)

Well I wanted it for every integer in that 40-70 range, which by that method would mean lots of those In Range functions.

0 Kudos
Message 6 of 8
(3,479 Views)

Could you have just one "In Range" function in a for loop and have the limits increment everytime the loop runs to limit the number of "In Range" functions? 

 

Angela Li

Applications Engineer

Message 7 of 8
(3,422 Views)

That's essentially what I ended up doing! See my previous post. 

0 Kudos
Message 8 of 8
(3,419 Views)