LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

extract xy graph's data from generic cursors

Solved!
Go to solution

Hi,i'm new in this Forum.

In my VI i need to extract xy graph's data from a cursor to another one,how can i do that?

I want to extract all the data between the two cursors,for elaborate it.

Thank you 🙂

0 Kudos
Message 1 of 10
(3,630 Views)

You need to show us what you have. Please attach a simplified version of your VI containing typical data.

 

  • Are the x value sorted or random?
  • Are the x-values spaced equally?
  • What is the datatype of the graph data?
  • You also need to explain what a "generic cursor" is. I am not familiar with that terminology.
0 Kudos
Message 2 of 10
(3,619 Views)

Ok i create this VI because it describes perfectly my situation. 🙂

0 Kudos
Message 3 of 10
(3,613 Views)

All the answers are in the VI 😉

0 Kudos
Message 4 of 10
(3,612 Views)
  • You have a race condition due to overuse of a local variable. Most likely the local variable is read before the graph is written.
  • Why is there no outer loop? Are you using "continuous run mode???)
  • Your two array don't contain any default data. After you place values into them, you need to make current values the default before saving the VI.
  • You code inside the FOR loop makes absolutely no sense.
0 Kudos
Message 5 of 10
(3,605 Views)
Solution
Accepted by giacom9222

In addition to everything altenbach said, you want the Cursor List: Index property. That will tell you where in the array of data the cursors are.

 

The attached VI shows how it can work and also how meaningless it can be with common types of XY data.

 

Lynn

Message 6 of 10
(3,597 Views)

Ok sorry,this version is better.I don't need while loop here,this is only a very small part of my program.
It works,but i can't undertand why it not extract the data correctly...in the graph with the extract data i don't have the portion between the two cursors!

thanks for your time

0 Kudos
Message 7 of 10
(3,595 Views)

For xy graphs, the array index has no relation to the x values and your subset makes no sense. You need to check if the x values are in range and discard if they are not. Here's a quick draft.

Message 8 of 10
(3,590 Views)

Thanks John,you solved my problem 🙂

0 Kudos
Message 9 of 10
(3,534 Views)

@giacom9222 wrote:

Thanks John,you solved my problem 🙂


Well, you required "from generic cursors", while Lynn's code uses cursors locked to a plot (as I already suggested here).

It only works if the X-values are sorted, and this cannot be guaranteed in the general case. (have you tried the "random" option in Lynn's code 🐵

 

It seems wasteful to get the entire cursor list if all you want is the cursor index.

You should also use the max&min function as I suggested. This way the two cursor positions don't need to be sorted.

 

Also note that if you would use complex data as I suggested, you would only need a single array subset operation, simplifying the code.

 

0 Kudos
Message 10 of 10
(3,526 Views)