From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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

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
(2,221 Views)
Solution
Accepted by 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 LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,215 Views)

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

0 Kudos
Message 3 of 5
(2,194 Views)
Solution
Accepted by 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
(2,130 Views)

Thank you, I have figured it out.

0 Kudos
Message 5 of 5
(2,109 Views)