LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to sum y values for a specific x range in the waveform graph

Solved!
Go to solution
Highlighted

Hello, I have a waveform graph that looks like below. Each bin is 5 ns and the total counts are the sum of y values for the whole x range. I wonder how to sum the y counts for an x range, such as 100-300 ns. My thought is to make a for loop to add the y value for every single x in the range of 100-300 (Not sure). If it is a curve, I may do the integral for x=100-300. Thank you

 

beyonddd_1-1594060703789.png

 

 

0 Kudos
Message 1 of 5
(200 Views)
Highlighted
Solution
Accepted by topic author beyonddd

Hi beyond,

 


@beyonddd wrote:

I wonder how to sum the y counts for an x range, such as 100-300 ns. My thought is to make a for loop to add the y value for every single x in the range of 100-300 (Not sure).


The data should be provided in an array, so all you need is an ArraySubset function followed by SumArray…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 2 of 5
(194 Views)
Highlighted

Got it. Thanks a lot, GerdW. I will extract the data as an array and try it.

0 Kudos
Message 3 of 5
(173 Views)
Highlighted
Solution
Accepted by topic author beyonddd

If it's a graph, you're providing an array as an input.  That's the data that's being represented by the graph.

 

Just take the subset of the array you're interested in.

0 Kudos
Message 4 of 5
(109 Views)
Highlighted

Thank you, I have figured it out.

0 Kudos
Message 5 of 5
(88 Views)