From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
09-01-2015 07:43 AM
Then I suggest you to not store the sample but the threshold comparison result in a single bit.
You'll need 2 u64 vectors. Convert them in boolean array and perform an AND operation over the array.
09-01-2015 08:14 AM
@ pnouvelize.
I like this idea.
But how to store the values? If you suggest an array, then how to update the oldest value with the newest sample?
09-01-2015 08:25 AM
You've already been given a mechanism to keep track of an index position.
1) Create a shift register
2) Increment it
3) See if it is equal to 100
4) Feed boolean into Select
5) If Select is true, output 0. Otherwise, output the incremented value
6) Send output to shift register
This will rotate an int between 0 and 99 incrementally.
It also works the way Sam mentioned. All you're doing with Sam's idea is keeping track of the last time you had a valid flag. You can handle the last 100 points whenever you feel like it. You don't have to process all of your data when you raise the flag. You have two general ways to attack this:
1) Grab all 100 points of data and then analyze for a valid flag.
2) Grab each point and analyze it on the spot as a flag. When you get the 100 points you want, handle your processing if flag is true.
His solution looks at the second way to do this. It's likely more efficient than any other you're going to find.
09-01-2015 08:32 AM
Here is the way I would do it :
09-02-2015 06:31 AM
Thanks for the suggestions!