LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Summing Contiguous (neighbouring) elements in an array

Hello All,

I have attached a figure where I show two 2D arrays: the one on the top is the raw data and the one below it is is thresholded data. I would like to sum up the elements between points A and B, points C and D and so on. I cannot think of an algorithm that would do that. I was thinking that you start at point A, look if the next element in the thresholded array has an
associated time that increments by one (I am collecting data every second) until you come to a point where the next element's time is not (last element's time +1) like the point labeled C.

At the moment I cannot think of a suitable way of doing this in LabView. Can anyone give me a few pointers as to how given the t
hresholded array, I can sum up elements if and only if they are contiguous?

Thank for you help.

KB
0 Kudos
Message 1 of 7
(2,936 Views)
Hello,

Here's something u could do if you just need to sum-up the different elements :
- create a 1D array with the original raw data
- sort it and sum up the data that are higher than your threshold.

Have a look at the image below. Hope this helps !
Julien
0 Kudos
Message 2 of 7
(2,936 Views)
Attached is a demo to do the peak detection/thresholding (from an earlier question of yours) which easily lends itself to doing the summing of x values that you're now looking for. It's in LV_6.1, but maybe it will help.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 3 of 7
(2,936 Views)
How do you get the corresponding time values? I mean you have summed up the counts values. How do you say that the sum x occurred duing the time interval y?
0 Kudos
Message 4 of 7
(2,936 Views)
'How do you say that the sum x occurred duing the time interval y?'
By something like the attached revision (?).
Apologies if I've misinterpreted your needs.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 5 of 7
(2,936 Views)
Donald,
That was exactly what I was looking for. Thanks.
Just one more clarification: How did you create an array using a graph as an input? Do you click on the graph to create a point? I tried to do that and did not find any way to create a point. I am trying to create an array for testing purposes and it would be easier to create one using a graph.

Thanks a lot for your help.

KB
0 Kudos
Message 6 of 7
(2,936 Views)
'Do you click on the graph to create a point?'
No. The graph was originally an indicator to which real data was fed. Then it was converted to a control and current value made default.

You might find the program Windig useful. (http://www.unige.ch/sciences/chifi/cpb/windig.html)
It's old/ancient, but still works on my Win2000. If you have a bmp of a graph, it will output the values to an ascii file which you could then read into LV.
Attached is a vi with what I got pretty quickly from an earlier jpg you posted (jpg > bmp > Windig > ascii file > LabVIEW).
=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 7 of 7
(2,936 Views)