LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

append multiple text files in labview

can anyone advise how to append datafile into another datafile in Labview ?

Thank you in advance !
0 Kudos
Message 1 of 5
(3,574 Views)
Most of the Write to... VIs in Labview have an Append T/F option. For instance, look at the "Write to Spreadsheet" VI (Functions>File I/O> palette). When you set this input to True, the data you're supplying the VI, will be appended to the related file you supplied in the file path. There are also some examples on this site and in the Labview File examples that you could modify to fit your need.
Good luck with it, Doug
0 Kudos
Message 2 of 5
(3,574 Views)
"Doug (CapeFl)" wrote in message news:<50650000000500000017520000-1005954886000@exchange.ni.com>...
> Most of the Write to... VIs in Labview have an Append T/F option. For
> instance, look at the "Write to Spreadsheet" VI (Functions>File I/O>
> palette). When you set this input to True, the data you're supplying
> the VI, will be appended to the related file you supplied in the file
> path. There are also some examples on this site and in the Labview
> File examples that you could modify to fit your need.
> Good luck with it, Doug

thanks, doug !

if I want to, say, right now I have 3 text file as below,

Temp & RH 10-m Interval Average Data For 11/18/2001
Date Time Temp Humd
11/18/01 00:13:43 20.02 58.04 *
11/18/01 00:23:43 19.99 58.17 *
11/18/01 00:33:43 19.97 58.11 *
11/18/01 00:43:43 19.94 58.13 *
11/18/01 00:53:43 19.95 58.04 *

Temp & RH 10-m Interval Average Data For 11/19/2001
Date Time Temp Humd
11/19/01 00:13:30 20.16 59.57 *
11/19/01 00:23:30 20.17 59.42 *
11/19/01 00:33:30 20.11 59.5 *
11/19/01 00:43:30 20.07 59.57 *
11/19/01 00:53:30 20.03 59.59 *

Temp & RH 10-m Interval Average Data For 11/20/2001
Date Time Temp Humd
11/20/01 00:13:17 23.1 59.39 *
11/20/01 00:23:17 23.18 58.96 *
11/20/01 00:33:17 23.55 58.43 *
11/20/01 00:43:17 23.61 58.43 *
11/20/01 00:53:17 22.75 59.62 *


can anyone advise me how can I append all the files become

Temp & RH 10-m Interval Average Data For 11/18/2001 to 11/20/2001
Date Time Temp Humd
11/18/01 00:13:43 20.02 58.04 *
11/18/01 00:23:43 19.99 58.17 *
11/18/01 00:33:43 19.97 58.11 *
11/18/01 00:43:43 19.94 58.13 *
11/18/01 00:53:43 19.95 58.04 *
11/19/01 00:13:30 20.16 59.57 *
11/19/01 00:23:30 20.17 59.42 *
11/19/01 00:33:30 20.11 59.5 *
11/19/01 00:43:30 20.07 59.57 *
11/19/01 00:53:30 20.03 59.59 *
11/20/01 00:13:17 23.1 59.39 *
11/20/01 00:23:17 23.18 58.96 *
11/20/01 00:33:17 23.55 58.43 *
11/20/01 00:43:17 23.61 58.43 *
11/20/01 00:53:17 22.75 59.62 *


thank you in advance
0 Kudos
Message 3 of 5
(3,574 Views)
Raymond,

As a start, open up each of the files and read them into separate strings
(one per file) using "Read Characters From File.vi". At this point it is
pure string manipulation to for the desired result. One method might be to
use the "Match Pattern" vi with "Humd\s" wired to the "regular expression"
input and the second file string wired to the "string" input. The output
labled "after substring" would then contain the contents of the second file
with the first two lines stripped off. Do the same for the third file
string. Then concatenate the three strings with "Concatenate Strings" vi.
The resulting string can be written out to another file using "Write
Characters To File.vi".

This is almost what you were asking for. You will still need to make the
first line of the resulting file show the end date, but by using the "Match
Pattern" and "Concatenate Strings" vis you should be able to see how to
accomplish that.

Hope this helps.

Jim


"Raymond Fang" wrote in message
news:d3203a1a.0112052350.580fa99d@posting.google.com...
> "Doug (CapeFl)" wrote in message
news:<50650000000500000017520000-1005954886000@exchange.ni.com>...
> > Most of the Write to... VIs in Labview have an Append T/F option. For
> > instance, look at the "Write to Spreadsheet" VI (Functions>File I/O>
> > palette). When you set this input to True, the data you're supplying
> > the VI, will be appended to the related file you supplied in the file
> > path. There are also some examples on this site and in the Labview
> > File examples that you could modify to fit your need.
> > Good luck with it, Doug
>
> thanks, doug !
>
> if I want to, say, right now I have 3 text file as below,
>
> Temp & RH 10-m Interval Average Data For 11/18/2001
> Date Time Temp Humd
> 11/18/01 00:13:43 20.02 58.04 *
> 11/18/01 00:23:43 19.99 58.17 *
> 11/18/01 00:33:43 19.97 58.11 *
> 11/18/01 00:43:43 19.94 58.13 *
> 11/18/01 00:53:43 19.95 58.04 *
>
> Temp & RH 10-m Interval Average Data For 11/19/2001
> Date Time Temp Humd
> 11/19/01 00:13:30 20.16 59.57 *
> 11/19/01 00:23:30 20.17 59.42 *
> 11/19/01 00:33:30 20.11 59.5 *
> 11/19/01 00:43:30 20.07 59.57 *
> 11/19/01 00:53:30 20.03 59.59 *
>
> Temp & RH 10-m Interval Average Data For 11/20/2001
> Date Time Temp Humd
> 11/20/01 00:13:17 23.1 59.39 *
> 11/20/01 00:23:17 23.18 58.96 *
> 11/20/01 00:33:17 23.55 58.43 *
> 11/20/01 00:43:17 23.61 58.43 *
> 11/20/01 00:53:17 22.75 59.62 *
>
>
> can anyone advise me how can I append all the files become
>
> Temp & RH 10-m Interval Average Data For 11/18/2001 to 11/20/2001
> Date Time Temp Humd
> 11/18/01 00:13:43 20.02 58.04 *
> 11/18/01 00:23:43 19.99 58.17 *
> 11/18/01 00:33:43 19.97 58.11 *
> 11/18/01 00:43:43 19.94 58.13 *
> 11/18/01 00:53:43 19.95 58.04 *
> 11/19/01 00:13:30 20.16 59.57 *
> 11/19/01 00:23:30 20.17 59.42 *
> 11/19/01 00:33:30 20.11 59.5 *
> 11/19/01 00:43:30 20.07 59.57 *
> 11/19/01 00:53:30 20.03 59.59 *
> 11/20/01 00:13:17 23.1 59.39 *
> 11/20/01 00:23:17 23.18 58.96 *
> 11/20/01 00:33:17 23.55 58.43 *
> 11/20/01 00:43:17 23.61 58.43 *
> 11/20/01 00:53:17 22.75 59.62 *
>
>
> thank you in advance
0 Kudos
Message 5 of 5
(3,574 Views)
I have attached a simple example that should be a great starting point for you. I left a little bit of it undone for you to finish up. The basic idea is to write the whole file the first time and then just append pieces (the data but not the headers) subsequent times. I have included a couple of the functions you will want to use but you can also look at the other string functions to see what they do as well.

Matt Kisler
Applications Engineer
National Instruments
0 Kudos
Message 4 of 5
(3,574 Views)