LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I average data within a range of x when y is over a certain value?

Solved!
Go to solution
I think that I would do something like this.Find Avg for Range.png
Message Edited by aeastet on 11-11-2009 01:43 PM
Message Edited by aeastet on 11-11-2009 01:48 PM
Tim
GHSP
0 Kudos
Message 11 of 29
(2,071 Views)
I realize I've posted this question twice, but can you elaborate how to use left, span, and array to determine the mean?
0 Kudos
Message 12 of 29
(2,060 Views)
Solution
Accepted by topic author g0dam0ng1n53ct5
Left edge gives you the first point.  Span tells you how many points there are.  Pass Left into the Index input of Array Subset, and span into Length input of array subset.  This gives you all points in question.  Then you average these.
--
Tim Elsey
Certified LabVIEW Architect
Message 13 of 29
(2,057 Views)

If you are looking at my diagram from above. The data going in is the bottom array. It is a constant here. If you look at the attached code you will better understand. You would set the upper limit to +inf and the lower limit to 603. The fore loop would index through the array and only pull out the values that are equal to or are between the limits. It then would process the array of valuse that meet this requirement and calculate a mean value.

 

Find Avg for Range.png

Message Edited by aeastet on 11-11-2009 02:02 PM
Message Edited by aeastet on 11-11-2009 02:02 PM
Tim
GHSP
Message 14 of 29
(2,055 Views)

Find Avg for Range.png


 

hmm....I like it.

 

OpenG makes it even better.

untitled.PNG

Message Edited by elset191 on 11-11-2009 01:10 PM
--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 15 of 29
(2,048 Views)
I got the same answer that you did.
Tim
GHSP
0 Kudos
Message 16 of 29
(2,045 Views)
It just occured to me that your method will take values if it goes above 600 for a second time.  The OP, I think, asked for just the first peak above the threshold.
--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 17 of 29
(2,038 Views)
One thing that you are going to have problems with with my code is if there is a second peak it will keep counting and averaging. There are ways around that but this will give you a simple solution for a simple curve.
Tim
GHSP
0 Kudos
Message 18 of 29
(2,036 Views)
What is the green box that you have on the picture?
Tim
GHSP
0 Kudos
Message 19 of 29
(2,035 Views)

It's the Conditional Auto-Indexing VI available from OpenG.  It basically does what your case structure does.  If the boolean is true, it keeps the corresponding number, otherwise it deletes it.

 

I beat you on calling out the bug in your code 😉

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 20 of 29
(2,030 Views)