11-29-2008 03:48 PM
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.
Solved! Go to Solution.
11-29-2008 09:38 PM
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?
11-30-2008 02:11 PM
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.
11-30-2008 03:52 PM - edited 11-30-2008 03:55 PM
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.
11-30-2008 08:00 PM
12-01-2008 11:36 AM - edited 12-01-2008 11:37 AM
OK, here's a slighly cleaner version that uses cursor references.