Streaming Dynamic Data in Array

musicgal411

New member
Joined
Oct 6, 2009
Messages
1
Programming Experience
Beginner
Hello all,

I am attempting to figure out the best way to place values into an array using dynamic data that is continuously streaming in from a ComPort. I want the array to hold 5 values at a time, with the newest incoming data point taking the place of the oldest data point. Each set of values in the array will be used in finding a trendline, which is then used in a later portion of the code.

Any ideas, or is more information needed to figure out what I'm doing?
 
Last edited:
How about a simple pointer?

VB.NET:
Private _arr(4) As Integer
Private _arrPointer As Integer = 0

...

' Incoming Data
Me._arr(Me._arrPointer) = incomingData
Me._arrPointer += 1
If Me._arrPointer >= Me._arr.Length Then Me._arrPointer = 0

Bobby
 
Back
Top