LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Select data between cursors on a graph

Solved!
Go to solution

"Thanks!

I've looked into state machines, and they indeed seem optimal.

 

Right now, I'm trying to first extract the data while the loop is running.

 

I'm stuck and don't know how to do it.

 

I'm using comparisons (> cursor[0] and < cursor[1]) and the "and " boolean to select the data between my two cursors, but I don't know how to extract them.

 

I've seen one of your posts that seemed to have the event structure, but I didn't really understand the code and

 

I can't implement it.

 

Any ideas?

0 Kudos
Message 11 of 25
(302 Views)

I'm not sure about the comparisons since the values from my array are on the "Y" axis and i'm using "posX".

0 Kudos
Message 12 of 25
(297 Views)

One way I would do is to use the Cursor.PosX for each cursor use these values to apply for Array subset, the first cursor is the index, the absolute value between the difference between Curso 0 and Curso 1 is the "SIZE", with that you will be able to select the portion of your signal to be exported to excel.

You could use the solution you were using, but after getting the arrays of booleans, you will need to run the array of booleans to each value of your array of data to select the data you want. It would do the same thing, but Array subset is already implemented for you to use. 

 

I would like to reinforce the State machine, after your program finishes collecting data, your program would to to a "select data to excell" state where you would show the data and allow th e use to export to excell. 

 

 

LVNinja_0-1721396397932.png

 

0 Kudos
Message 13 of 25
(290 Views)

@Alexb91 wrote:

I'm not sure about the comparisons since the values from my array are on the "Y" axis and i'm using "posX".


If you have two cursors and define a rectangle and want to select a subset of xy points that fall into that area, you should probably start with an xy graph. A waveform graph assumes points equally spaced in x, but points that fall into a certain Y range could well be scattered over many discontinuous segments. (I fake it by setting outside points to NaN).

 

As I already said, you are using x for one cursor and y for another cursor and it is not obvious how that should put desired bounds on your data. Can you show a sketch of the data and cursors and point to the area you like to select?

 

 

0 Kudos
Message 14 of 25
(257 Views)

Hi, here is an example of data i'd like to select.screenshot daq excel.png

0 Kudos
Message 15 of 25
(248 Views)

The problem is that I don't know how to create an xy graph with an array, as I have 9 signals and not just two.

0 Kudos
Message 16 of 25
(248 Views)
Solution
Accepted by topic author Alexb91

You don't need to create XY . 

Go back to your data graph, you are ploting 2D array of data. 

 

Right click on your plot, and select properties

On the tab Cursors, on Allow Draggin, select single-plot and select Trace 0. 

this will "lock" the cursor with your first plot.

LVNinja_1-1722345496914.png

 

Then the diagram you will use the property node, Active cursor and Cursor Index, will give you the index of the cursor , with that information you will use Array subset to select the portion of the data you want to save it. 

I suggest to save to a CSV file to make things easier, to export to Excell you will need to use Active X. You can add the cursor X 1 and X2 to knwo the portion of the data you are saving. 

 

Message 17 of 25
(239 Views)

Thanks for your answer.

It seems like a good idea and much less of a hassle than using loops and booleans.

 

I tried it, but I'm not getting any values in my subarray.

Did I make a mistake somewhere? I've attached two screenshots and my current code.ss no values back end.pngss no values front end.png

0 Kudos
Message 18 of 25
(238 Views)

Why do you suggest locking the cursor on the first plot since there is 9 plots?

0 Kudos
Message 19 of 25
(230 Views)

@Alexb91 wrote:

Hi, here is an example of data i'd like to select.screenshot daq excel.png


So you want to leave out the white data at the bottom? What should happen if some data is only selected partially?

 

Do all the traces really have different x-values that are randomly spaced?

 

How do you want the output of the selection arranged?

0 Kudos
Message 20 of 25
(221 Views)