LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

finding the average between 2 cursors

Hi. I am using LabVIEW to produce a graph of force against time, and I am using cursors to locate specific points on this graph while the vi is running. I want to find the average force value between selected cursor points (either during or after the run) but I don't know how to do this - can anyone help?
0 Kudos
Message 1 of 22
(4,567 Views)

Use cursors that are locked to the plot (not free). Easiest would be to use the "cursor index" property, which gives the array index corresponding to the cursor positions. Now simply use the two indices and get the array subset accordingly. Feed it into "Mean" from the probability&statistics palette.

 

 

0 Kudos
Message 2 of 22
(4,558 Views)

Here's a quick example (LabVIEW 8.5).

 

Let me know if you need a older version or have questions.

0 Kudos
Message 3 of 22
(4,555 Views)
Thanks for the quick reply - does this just give the average of the 2 points where the cursors are or is there a way to get the average of all the points collected from between the 2 cursors (say I am taking 100 points and I put a cursor at point 10 and point 60. I want to find the average of all the points in between and not just the 2 points).
0 Kudos
Message 4 of 22
(4,537 Views)

It gives the average of all points between the two cursors.

 

(It takes the sub-array starting at the lower cursor with a length of as many points as you have between the two cursors.)

 

Is there anything in the code or results that makes you think otherwise?

0 Kudos
Message 5 of 22
(4,533 Views)

Sorry I couldn't check the example you sent until this morning but I have an older version of LabVIEW (8.2). Is there any way you could send another example which I can open with this older version?

 

Thanks.

0 Kudos
Message 6 of 22
(4,501 Views)

OK, here's a downconverted version. (I have not tested it in 8.2, hopefully it is still intact. :D))

 

(It might need a tweak or two, depending on if you want to include or exclude the cursor positions in the mean calculation. Modify as needed)

Message Edited by altenbach on 11-10-2008 11:55 AM
0 Kudos
Message 7 of 22
(4,499 Views)
Thanks that's exactly what I was after. But my graph is a 2D array with multiple plots (I have a bundle of 5 waveforms) and now I can't seem to connect the input from the bundle because it isn't of the same form as the array. Would I just need to use a resize array function to change it into a 1D array or should I be using something else to make it work with the example? Sorry I'm new to LabVIEW!
0 Kudos
Message 8 of 22
(4,485 Views)
Can you attach a simplified version of your program that contains your data structures?
0 Kudos
Message 9 of 22
(4,480 Views)

It's a very big file so I've created a picture as an example - I've used random numbers instead of the real data being fed into the bundle (they are all DBL) because this data has been calibrated before it is fed in. I have got a moving chart of all 5 plots and a graph of the 5 plots to show the entire run (waveform graph). It is this waveform graph where I want to put the cursors and then find the average between them - I can lock the cursors to the relevant waveform. Would I connect from (a) or (b) in the picture into the array? I didn't get any errors when I connected from position (a) but I just wanted to check I was reading in the right data. Thanks again for your help.

 

 

0 Kudos
Message 10 of 22
(4,473 Views)