Hello dear NI team.
I am a bit confused to ask such a question, may be I need to refresh my C# types knowledge. But, here is my question:
In my application (C# 4.0 Winforms) the data that I place into plot could be very large, easily 5 million points for exaple. And then I have two vertical cursors (XYCursor objects).
I want to know some data statistics for the part of plot placed between those two cursors. Well, to get the part of data that I have to gather statistics for I use XYCursor's GetCurrentIndex() method.
Pseudo would be:
start = min( cursor1.GetCurrentIndex(), cursor2.GetCurrentIndex())
end = max( cursor1.GetCurrentIndex(), cursor2.GetCurrentIndex())
statistics = GetStatistics( data, start, end)
Can I get some errors due the fact that GetCurrentIndex return type is int? Why it was declared with integer as return type? Why not unsigned integer?
oops.... from http://msdn.microsoft.com/en-us/library/5kzh1b5w(v
Thanks for your post. Yeah the function returns a 32bit integer value which should satisfy your needs.I haven't used the fuction but suspect that you will be able to get minus values returned if using it. If cursor 1 is less than cursor 2 in the x and y directions would the function not return a negative value?
I didn't explained myself good enough.
I am interested to know minimum, maximum and average value for some group of points. And this group of points is defined by user, those are the points located between two cursors that user can move. Lets say i gather some data from some device which works for 5 hours, measurments taken every 5mS. I will have a ton of points... and now user wants to know max/min/average of points measured in second hour. He places two verical cursors on 1 hour and 2nd hour marks accordingly. Now I can use Cursor's GetCurrentIndex() function to get the index of start and finish of my points set. Now I can measure my statistics.
And my question/worry was about this int32 overflow issue. It is hardly reachable, but hey... my device measure with 800kHz frequency, give it a time, it will burry you in points.