02-05-2014 05:46 AM
Hi Guys!
I have an input txt file like this (the columns are separated with tabs):
A: B:
Kyle Josh
Anna Martin
Jon Jenny
I need a VI which randomly matches pairs, one item from "A" with one item from "B". It should match all the pairs (in the example 3 pairs), and one item can be used only once. Of course I don't need the first line to be matched (the letters "A" and "B"). The number of the lines can change, and the values are not fixed.
I would like to kindly ask for your help.
Solved! Go to Solution.
02-05-2014 06:01 AM - edited 02-05-2014 06:01 AM
Hi hofferistvan,
- read the file using ReadFromSpreadsheetFile into an 2D array of strings.
- Delete the first row, index the first two columns.
- Feed both columns as 1D array to shift registers of a FOR loop.
- Delete a random element from both 1D arrays in the loop and output them as pair.
- Repeat the loop as long as there are elements in the array…
02-05-2014 06:30 AM
Thank you, but could you tell me, which functions I should use at each step you listed?
It would be a great help.
02-05-2014 06:56 AM
One other approach:
Read file and delete header as GerdW suggested then use the below
02-05-2014 07:11 AM
Thank you, it seems to work. But one question: how is that function called on which there is "DBL abc"?
02-05-2014 07:20 AM