LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Searching for a Range Within a 1D Array

First, I should say that I did a search through the forums and tried some of the results but couldn't get the results that I was looking for.

 

I have a 1D array of a column of temperature data.  The temperature data spans roughly 10 degrees total, and most of it is accurate to the thousandths digit place (X.xxx). 

 

What I need to do with this data is separate it into certain ranges or manipulate it in its current state.

 

Less than range A has something happen to it, between A and B has something happen to it, C and D... etc.  The easiest way to do this would probably just separate them into their own arrays and go from there, but im kind of at a loss at how to do this.  I tried to make a CASE structure work but i failed.  Any help would be great!

0 Kudos
Message 1 of 5
(2,490 Views)

@takari wrote:

Less than range A has something happen to it, between A and B has something happen to it, C and D... etc.  The easiest way to do this would probably just separate them into their own arrays and go from there, but im kind of at a loss at how to do this.  I tried to make a CASE structure work but i failed.  Any help would be great!


What is "something" that needs to be done??? For example if you simply want to average the subranges, there is no need to built the arrays up first).

 

To split the data into seperate arrays depending on defined ranges, you could do something as in the attached.

 

(Of course you lose all information about original order of the elements. If order does not matter, you could simply sort the array then split it at the thresholds, for example)

0 Kudos
Message 2 of 5
(2,484 Views)

The first range just gets substituted with a integer value, the second range will get thrown into an equation, and the last two ranges will get subed with an integer value.  In the end, the result of all these transformations will just be added together. 

 

I'll take a look at what you attached.  Thanks for the help!

 

I managed to construct a program that will give me the indicies of the 1d array that fall within a given range.

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

Oh, and the original order of the 1d array is not important.

0 Kudos
Message 4 of 5
(2,480 Views)

@takari wrote:

In the end, the result of all these transformations will just be added together. 


In this case you don't even need to built the arrays. SImple keep a running scalar sum in the shift register. 

0 Kudos
Message 5 of 5
(2,474 Views)