LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combine many .txt files from folder into one file

Solved!
Go to solution

Hi,

 

In one folder, I have many (300+) files each with two columns of data. The files are named in numerical order: File1.txt, File2.txt...File100.txt. I would like to combine the files so that the columns of File2.txt fall under the columns of File1.txt.

 

Say File1.txt = 1   2

                          2   4

                        

 

And File2.txt = 3   6

                          4   8

 

The combined file should read: 1   2

                                                          2   4

                                                          3   6

                                                          4   8

 

The files are all tab delimited.

 

I have started a VI that I think to be in the right direction, but there is an error currently in wiring connections. Could you please tell me the problem with my VI or, perhaps, suggets a better method for accomplishing this task?

 

Thanks,

 

M

0 Kudos
Message 1 of 6
(6,062 Views)

Right-click the tunnel on the right side of your For loop and select Tunnel Mode > Concatenating.

 

P.S.

  • You don't need to wire the N on the For loop like that because the input tunnel is auto-indexing.
  • Your "\t" is incorrect because the string is in normal string mode instead of "\" notation. Just delete that because the default is tabbed.
  • You don't need to input "2" for the number of rows because default is All

This is all you need:

CombineTXT.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 2 of 6
(6,039 Views)

I do not have the option to choose the tunnel mode, I am using LabView 2011. If I disable indexing on the right side of the loop, it allows for the array to be passed to the write to spreadsheet node but only writes the first of the files.

0 Kudos
Message 3 of 6
(6,012 Views)
Solution
Accepted by Miggy26

if you're using LabVIEW 2011 you might need to do this instead.

 

Tunel modes have been added in 2013.

 

txt merge.png

Message 4 of 6
(6,010 Views)

The shift registers did the trick. Thanks for the help!

0 Kudos
Message 5 of 6
(5,988 Views)

Could you please share the VI?

0 Kudos
Message 6 of 6
(3,176 Views)