LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compile and add similar data from an array

Hello,
 
I have a task to sort data for errors and provide a quick analysis.  I have a 2d array with the valve# and a binary # to indicate pass/fail. The data file has 1000 data points and is formated as follows:
 
1   1                                   Left Column = Valve#
1   0                                   2nd Column = 1 for fail, 0 for pass
1   0
1   0                                   So in 10 data samples, valve #1 had 3 failures.  This data repeats 10 times/valve for 20 valves.  After the last data point for valve 20 is collected, the loop jumps back to 1.  
1   1
1   0
1   0
1   1
1   0
1   0
 
 
What I want to do is have the VI display that in 1000 samples, valve# XX had XX number of failures.  Any help would be appreciated.
 
Henry
 
 
Download All
0 Kudos
Message 1 of 2
(2,497 Views)
There's a variety of ways of doing this:

One way is to sort your 2D array by the valve# column so then you can "chop out" each valve# in a for-loop and then add up the "Pass/Fail" column (via the "Add Array Elements" function) by converting it to a boolean column where Fail=1.

Another way without the sort is to filter the data for each valve. For this I would suggest getting the OpenG Array library and using the "Conditional Auto-Indexing Tunnel" function. This gives a pretty clean implementation. Attached is an example using the latter method.

Yet another method is to check each row line by line and then use a shift register to increment your population of the 2D array of valve# vs failures.
0 Kudos
Message 2 of 2
(2,475 Views)