LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

parsing array

Suppose I have a 2D array as follows with two columns, and a few rows. Let's call the first column x, and the second one y
x      y
17   1
26   0
45   1
66   1
87   1
95   1
111   0
117   1
472   0
473   1
17   1
For x elements that are repated, I want to add up their corresponding values together, so instead of having two rows with
17   1
17   1,
I want just one row with 17 2.
Is there an easy way to do this. I would also like to get rid of all rows that have a 0 in the y column.

Thank you
0 Kudos
Message 1 of 6
(2,981 Views)
Yes, you can do it but with some array acrobatics. Probably not the best way but it does what you want.
 
Example in 7.1
 
David
Message 2 of 6
(2,964 Views)
Thank you,

This is perfect. Just what I was looking for.
0 Kudos
Message 3 of 6
(2,951 Views)
I know this was answered for you but the problem caught my attention and I found an alternate solution that may be a bit faster using the aforementioned array voodoo.

I added my code to the original solution for comparison.

Cheers,
Greg Cole
“It is not the ship so much as the skillful sailing that ensures the prosperous voyage.”
Message 4 of 6
(2,937 Views)
Hi,

Thank you for your code. The only thing is I can't open it since I only have labview 7.1 and 8.0. It would be best if you could save it to 7.1 if that is avialable to you.
0 Kudos
Message 5 of 6
(2,922 Views)

No problem, here it is in LV 8.0.1

Cheers,

Greg Cole
“It is not the ship so much as the skillful sailing that ensures the prosperous voyage.”
Message 6 of 6
(2,907 Views)