LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there an easy way to filter a 2-d array based on the values of two of the fields?

Solved!
Go to solution
Highlighted

Is there an easy way to filter a 2-d array based on the values of one of the fields. In my attached VI the output array has the following format:

 

TimeStamp        Ident                Frame Type          Bytes    Data

 

10:57:07.621   3AD00016   CAN Data Frame   8          0000000000000000

10:57:07.622   3AD00017   CAN Data Frame   8          000005E000000000

10:57:07.624   3AD00018   CAN Data Frame   8          0000000003300000

10:57:07.625   2DC00000   CAN Data Frame   8          0000000000000000

10:57:07.626   3AD00019   CAN Data Frame    4         0000030000000000

 

I would like to delete any rows that do not have an "Ident" between the values of 3AD00000 and 3AD0001E. So for the above data the fourth row would be deleted. The only way I can see to do it is to form a 1-d array. Is there a better approach?

 

Thank you.

0 Kudos
Message 1 of 5
(1,171 Views)
Highlighted

Hi chuck72352,

you can sort your data by the Ident column. Search the latest valid value in your array and create a subset of all data before it.

 

Mike

Message 2 of 5
(1,160 Views)
Highlighted

I know how to do the sort, but I'm not sure of an easy way to do the search.

 

Thank you.

0 Kudos
Message 3 of 5
(1,156 Views)
Highlighted
Solution
Accepted by topic author chuck72352

Hi chuck72352,

after you have sorted your data, you can use the InRange Function. Combined with a "search 1D Array" you'll get the range you really want.

 

Mike

Message 4 of 5
(1,150 Views)
Highlighted
Thank  you!
0 Kudos
Message 5 of 5
(1,145 Views)