09-21-2014 02:28 PM
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 🙂
Solved! Go to Solution.
09-21-2014 02:58 PM - edited 09-21-2014 03:01 PM
You need to show us what you have. Please attach a simplified version of your VI containing typical data.
09-21-2014 03:01 PM
Ok i create this VI because it describes perfectly my situation. 🙂
09-21-2014 03:02 PM
All the answers are in the VI 😉
09-21-2014 03:16 PM - edited 09-21-2014 03:41 PM
09-21-2014 03:30 PM
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
09-21-2014 03:31 PM
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
09-21-2014 03:43 PM
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.
09-22-2014 01:06 PM
Thanks John,you solved my problem 🙂
09-22-2014 01:25 PM
@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.