- Community Home
- :
- Discussion Forums
- :
- Most Active Software Boards
- :
- Measurement Studio for .NET Languages
- :
- int GetCurrentIndex() of XYCursor

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted
# int GetCurrentIndex() of XYCursor

Options

04-22-2012 04:00 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

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?

04-22-2012 04:07 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

04-30-2012 05:34 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

Hi,

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?

Thanks,

Aaron. E

Product Performance Engineer

Dyson

Product Performance Engineer

Dyson

04-30-2012 08:22 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

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.