Ah glad you found a solution!
I would think it would be faster to do the search on the instrument using the TSP engine, did you try that? Unless you needed all the readings on your PC anyway. Or it sounds like things are running fast enough for you already.
This TSP code searches through defbuffer1 to find all instances of num within a tolerance (since defbuffer1[i] returns more digits than the measurement resolution).
function countInstance(num, tolerance)
local count = 0
local high = num + tolerance
local low = num - tolerance
for i = 1, defbuffer1.n do
if high > defbuffer1[i] and defbuffer1[i] > low then
count = count+1
end
end
return count
end
After putting this function on your DAQ6510, you simply run print(countInstance(num, tolerance)) to return the count to the terminal.