LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inner Join for 2D Arrays

Hi all.

 

I have 2 sets of data that we need the difference of.

However both sets might have erronous duplicate readings that cause either one or both of them to be of UNEQUAL length.

Data is 2D with the column 0 being timestamps and column 1 being a physical number.

I need the timestamp column to correspond for both arrays, at the same time making them the same length.

 

I believe the following method is somewhat similar to the INNER JOIN function that SQL Databases use.

 

Example:

 

Timestamps will be shown as TX.

 

Set A (size of 😎

T1   0.1

T2   0.1

T2   0.1

T3   0.2

T4   0.1

T5   0.3

T5   0.3

T6   0.2

 

Set B (size of 6)

T1   0.9

T2   0.8

T3   0.7

T5   0.9

T6   0.9

T7   0.8

 

From the above 2 sets, either set can have missing or duplicate data. The corrected array should look like:

 

Set A (corrected size of 9)

T1   0.1

T2   0.1

T2   0.1

T3   0.2

T4   0.1

T5   0.3

T5   0.3

T6   0.2

T7   NaN <--- added from B's T7

 

Set B (corrected size of 9)

T1   0.9

T2   0.8

T2   NaN <--- added from A's additional T2

T3   0.7

T4   NaN <--- added from A's additional T4

T5   0.9

T5   NaN <--- added from A's additional T5

T6   0.9

T7   0.8

 

Sorry for being long-winded but I couldnt see any other way to explain it.

 

Help would be appreciated.

 

Thanks.

0 Kudos
Message 1 of 2
(2,582 Views)

You'll need to loop through Set A's TX and do a Search Array against Set B's TX. If Search gives -1, it isn't found and you should add it to Set B. Then do the same in the opposite way.

Since TX is the 1st element you can just do a Sort afterwards.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 2
(2,507 Views)