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: 

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

Solved!
Go to solution

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
(2,728 Views)

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
(2,717 Views)

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
(2,713 Views)
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
(2,707 Views)
Thank  you!
0 Kudos
Message 5 of 5
(2,702 Views)