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: 

Filter rows from an array, based on criteria in two of the columns

Solved!
Go to solution

Is there an easy way to filter a 2d array, based on the values of two of the columns? For example in my VI attached the output array has the following format:

 

10:57:07.776

0 Kudos
Message 1 of 3
(2,521 Views)
Solution
Accepted by chuck72352

Quick answer:

 

Convert your 2d array to an array of cluster where the order of the cluster defines how tie-breakers are handled (first fields are equa so serach on second item in cluster)

 

Run that thru a Sort 1d array and convert back to a 2d array.

 

Faster approach:

 

Only bundle up the serach fiels along with an index. Do the search then use the index to re-order the original array.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 3
(2,512 Views)
I used the function "Build Cluster Array" and "Sort 1 D Array" as you suggested, then I dumped that to a file so that I can do the processing with a C routine. My plan is to write the filter routine in C then access it with Labview.
0 Kudos
Message 3 of 3
(2,501 Views)