# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution
Highlighted

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

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

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

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

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
Message 2 of 5
(194 Views)
Highlighted

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

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

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

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

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.

Message 4 of 5
(109 Views)
Highlighted

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

Thank you, I have figured it out.

Message 5 of 5
(88 Views)