05-13-2012 02:22 PM
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!
05-13-2012 03:12 PM - edited 05-13-2012 03:13 PM
@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)
05-13-2012 03:24 PM
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.
05-13-2012 03:25 PM
Oh, and the original order of the 1d array is not important.
05-13-2012 03:39 PM
@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.