LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combining data files

Hi,

 

I tooks data from hardware and saved it as a series of small files so I would not be stuck with huge files. Now I want to put together some of these files. I have the files as data_001.lvm, data_002.lvm, data_003.lvm etc. I have tried using the merge files option but it put the data side by side. I want this data to be output in the same columns so that I have  a column with all the time data and a column with all the sampled amplitudes.

 

I have attached 2 exapmles of the data files. I am using Labview 7.0.

 

Thanks, Magreen

Download All
0 Kudos
Message 1 of 14
(4,029 Views)

Hi Magreen,

read your files and merge it with one of the others. Use the file IO vis

Mike

0 Kudos
Message 2 of 14
(4,024 Views)

Hi This is one method for doing it with text files.

 

 

 

 To expand on this concept you could put the operation in a for loop with an array of filenames as the IP. and a shift register to keep appending each file.

Craig

Message Edited by craigc on 08-13-2008 09:47 AM
LabVIEW 2012
0 Kudos
Message 3 of 14
(4,023 Views)

Thanks for replying.

I can't seem to find the component just after path,

(The yellow one with a picture of glasses:)

what is this component? is it in Labview 7?

0 Kudos
Message 4 of 14
(4,011 Views)
yeah it is on Block Diag window, in functions, programing , File I/O, Read text file.
0 Kudos
Message 5 of 14
(4,008 Views)

Hi Magreen,

you can also use the "Seek" function. If you use it you only need to read one file. Open the other file, move the "cursor" to the end of file position and write the read data to this file. If you do you don´t need to read all data into memory.

 

Hope it helps.

Mike 

0 Kudos
Message 6 of 14
(3,979 Views)

I managed to combine the files using the attached files.

Now I need help using a loop to combine a large number of files.

In this example I combine only 3  files. In reality, I would need

to do this for maye 100 files.

Download All
0 Kudos
Message 7 of 14
(3,955 Views)

May file tools have changed, but you definitely don't want to read it as numerics, sice your files are already formatted.

 

Read your files as a plain text string in a loop and append the string to a new file until you run out of files. Here's a quick draft that you need to adapt to LabVIEW 7.0.

 

Message Edited by altenbach on 08-15-2008 10:27 AM
0 Kudos
Message 8 of 14
(3,939 Views)

Thanks,

 

Is it possible that you email this as a vi. file.

I cannot locate some of the tools you have used.

 

0 Kudos
Message 9 of 14
(3,934 Views)

As I said, the file IO has changed quite a bit since LabVIEW 7.0. Since my VI is in LabVIEW 8.5, you won't be able to open it.

 

Still you should be able to create it from scratch.

 

  • Create a while loop
  • define the folder containing your file (e.g. using  the file dialog or a diagram constant).
  • Open a new file for the output.
  • In the loop, create the file names according to the format pattern
  • If the file does not exist (e.g. "file info" generates an error), do nothing and stop the loop
  • if the file exists, read as a plain text string and append it to the new file.
  • Repeat until you run out of matching files.
  • Close the new file.

 

(You could also use "list files" with e.g. "data_*.txt" as pattern and simply autoindex over the file names in a FOR loop.)

 

See how far you get. If you think you are close, attach your work and we find out what else is needed. 😉

Message Edited by altenbach on 08-15-2008 11:00 AM
0 Kudos
Message 10 of 14
(3,928 Views)