05-09-2013 12:25 PM
Yes this was just an exercise. But it is very closely related to what I'm trying to do. I'm receiving a data stream and sampling every 10th point, then every 100th point, then every 1000th point, etc. I was using the Quotient & Remainder function to determine if my timepoint was a multiple of a number, which would indicate it should be sampled.
05-09-2013 12:50 PM
@tda*! wrote:
Yes this was just an exercise. But it is very closely related to what I'm trying to do. I'm receiving a data stream and sampling every 10th point, then every 100th point, then every 1000th point, etc. I was using the Quotient & Remainder function to determine if my timepoint was a multiple of a number, which would indicate it should be sampled.
This is a good start at explaining what you *really* need to do. Maybe if you could be a little more specific about the details of what you need to do, we can come up with something better than testing every data point that comes over.
05-09-2013 02:13 PM
So my problem is as simple as receiving a datastream with a timestamp and saving to file every 10th point for, say, 1000 points, then every 100th point for another 1000 points, etc.
05-09-2013 02:17 PM
So store your count in a shift register as an integer. Keep adding 1 to it.
Store your target in a shift register as an integer. When count (an integer) equals the target (an integer), log the data, then multiply the target by 10 and store that value back into the shift register.
Nowhere do you need to do comparison of floating point numbers.