LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Match entries in one array to another array and create a new array.

Solved!
Go to solution

I assume I can use a similar procedure for this other operation as well.  For now the answer was small enough (9,616 records in ARRAY1 and 12 records in ARRAY3) that I was able to do via copy and paste in Excel, but in the future I wish to do this automatically as well.  I assume you noticed that there was a time and date column in ARRAY1.  My project really has three input arrays not two.  I figured once I figure out how to combine two I can use the same process on the third.

 

But the third is a little different.  For the third I only have data at the top of the hour.  Therefore I wish to first compare on the date as before but then need to compare and match on the time and I only wish to use the HOUR.  ALL records in the final output array ARRAY4 must have the data in ARRAY3 combined with ARRAY1 matching the HOUR.

 

19619i4A6B416895FA8484

 

I will try to make the this code later but if you beat me to it that would be greatly appreciated.

0 Kudos
Message 11 of 20
(1,786 Views)

Holy crap, a chance to use a regex and variants in the same solution.  My mouse hand is twitching uncontrollably, but I will let you have the fun and just give you a couple of tips.  I will make a few assumptions based on your data.

 

First, copy the first For Loop in my example to create a second variant for what you now call Array 3 (top of the hour data).  In the other For Loop you need to change the code that appends data.  Now you also need to get the corresponding value from Array 3.  To convert the key, take the one you got from Array 1 in the form of date-tab-HH:MM:SS and use Search and Replace as follows to make it date-tab-HH:00:00, get the value of this key from the new variant you created and append it as well.  You may want to double check that it exists, or just assume that it will if you know your data.

 

19671i2651055C3D766260

 

Let me know if you need more advice, and if you do, please be prepared to post a little bit of data (not your entire files!)  The regex if you are interested looks for a tab, some digits (which it keeps) a colon and then anything.  In the replace regex I put back the tab, the digits that matched (that is what $1 means), and :00:00.

Message 12 of 20
(1,766 Views)

@Darin.K wrote:

Holy crap, a chance to use a regex and variants in the same solution.  My mouse hand is twitching uncontrollably,


Darrin, you need professional help.  Smiley Wink

- tbob

Inventor of the WORM Global
0 Kudos
Message 13 of 20
(1,752 Views)

 


@tbob wrote:

@Darin.K wrote:

Holy crap, a chance to use a regex and variants in the same solution.  My mouse hand is twitching uncontrollably,


 

Darrin, you need professional help.  Smiley Wink


I'll tell my therapist to up the voltage....

 

Message 14 of 20
(1,745 Views)

 

Hi @Garin.K, what about this in one array compare two columns values and get 3rd column value in variants method.

0 Kudos
Message 15 of 20
(1,451 Views)

@sam67 wrote:

 

Hi @Garin.K, what about this in one array compare two columns values and get 3rd column value in variants method.


What about you replying to a 9 year old thread with a cryptic sentence that makes little to no sense? It is not even obvious if you have a question or a suggestion! (And it's Darin, not Garin.)

 

Please clarify...

0 Kudos
Message 16 of 20
(1,443 Views)

@altenbach  작성:

Please clarify...


Please see the attached picture. In this file, there are some columns, Column D and J has some specific same range of data. I need to match these values and then those values which is in column C corresponding to those match values which is in columns D and J. Thanks Sir 

0 Kudos
Message 17 of 20
(1,435 Views)

You are still not making sense. What do you want to "match" with what and what should happen if a match occurs?

0 Kudos
Message 18 of 20
(1,414 Views)

@altenbach  작성:

You are still not making sense. What do you want to "match" with what and what should happen if a match occurs?


Hi, for example in column D and J has value 15.63 15.34 15.67 ........, and in corresponding the column C has value 25 24 25 53 22 32 43 25. like this i need these values.

0 Kudos
Message 19 of 20
(1,401 Views)

You are spreading your questions around  to multiple threads just fragmenting the discussion even more.

 

Please stick to one thread!

 

I would suggest this one https://forums.ni.com/t5/LabVIEW/Searching-from-excel-file/td-p/3884173 since it is your own thread and not an ancient one.  It is ridiculously long, but at least anyone else who tries to help will have the benefit of seeing all the messages already added that hopefully you have read by now that tell you what you need to do.

0 Kudos
Message 20 of 20
(1,386 Views)