06-22-2020 10:25 AM
I have two 2D arrays. I want to compare them by searching for the letters in the 1st column of each array. If there is a match insert the associated row from the small array into the large array in column 3, else just keep the original row of the big array. My issue is that the array only retains the last value. I tried implementing an additional for loop with an additional set of shift registers, but I get
i @@@ #### for all my matched rows.
Big Array:
Small Array:
Result:
Desired Result:
VI:
Please help thank you.
Solved! Go to Solution.
06-22-2020 10:48 AM - edited 06-22-2020 10:50 AM
You seem to have multiple b's in each array and it seems you want to cycle through them in the small array if consecutive b's occur in the big array. can you describe the full rules leading to the desired result? Are the arrays guaranteed to be sorted by the first column?
06-22-2020 10:59 AM
Yes there are multiple b's, and I want to cycle all the b matches available from the small array. The want to match the 1st alphabetical columns and insert the row from the small array into the big array. The overall goal of this vi is to take the big array and insert rows of the small array where the alphabets match (data aggregation). I do not want to lose any data from the big array and only want to populate it with matching small array rows.
06-22-2020 11:18 AM - edited 06-22-2020 11:23 AM
See if this can give you some ideas. I am sure it could be simplified further....
(of course it assumes that the big array has sufficient empty columns for the replacement)
06-22-2020 01:52 PM
06-22-2020 02:14 PM - edited 06-22-2020 02:36 PM
And if you really want to only iterate over the small array, here's how that would look like:
(Make sure you understand why the built array is needed ;))
Of course this still assumes that both arrays are sorted by the first column.)
06-22-2020 03:32 PM
Thank you altenbach, all your responses implemented very well.