LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

average between multiple cursors

Solved!
Go to solution

Hi,

 

Thanks to help from another post I managed to find the average value between 2 cursors. Now I want to add more cursors and do the same thing. I thought this would be straightforward, but for some reason I can only get the average value for between the first 2 cursors and not any of the others. Could anyone tell me where I'm going wrong so I can find the average between cursors 2 and 3, and then 4 and 5 etc etc. I've attached a pic and would be grateful for some help.

 

Thanks. 

0 Kudos
Message 1 of 6
(2,849 Views)

Your code makes very little sense to me from the picture alone. Can you attach your actual VI instead?

 

Basically, you would simply loop over all subset between the cursors in a FOR loop.

 

What is your definition of "the same thing"?

 

Say you have 4 cursors, do you want the subset between 1/2 and 3/4 or do you also want the subset between 2/3?

0 Kudos
Message 2 of 6
(2,830 Views)

Thanks for getting back. Sorry I didn't make much sense - I'm attaching a sample VI with a sine wave because my VI is too big. But what I want to do is find the average between cursor 0 and cursor 1, and then for cursor 2 and cursor 3 (I don't need the average between cursor 1 and cursor 2). At the moment I can get the average between cursor 0 and cursor 1, but I keep getting the same value for cursor 2 and cursor 3 when it should be different. Can you tell me where I'm going wrong?

 

Thanks.

0 Kudos
Message 3 of 6
(2,801 Views)
Solution
Accepted by topic author Lun13

Well, simply read all the cursor indices (make sure you use cursors locked to a plot, not free ones as you had), sort the indices, and take the subsets between the two lowest and two highest indices.

 

 

 

Easy, right? Let me know if you have any questions.  As before, you need to decide of you want to include the range boundary, so modify as needed.

Message Edited by altenbach on 11-30-2008 01:55 PM
Download All
0 Kudos
Message 4 of 6
(2,792 Views)
Thanks so much - it works!!!
0 Kudos
Message 5 of 6
(2,778 Views)

OK, here's a slighly cleaner version that uses cursor references.

 

Message Edited by altenbach on 12-01-2008 09:37 AM
Download All
0 Kudos
Message 6 of 6
(2,743 Views)