LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replacing the one column of data in txt file with headers

Solved!
Go to solution

I have the data saved in txt format with headers like:

 

Date:
Sun, Mar 12, 2017
Time:
9:56 PM
Delta t (us)
499.999999E-3
Temperature (K):
300
Reactor Pressure (torr):
9.990000E+0

Time (microseconds) #$ Data
-5000.000000 0.000042
-4999.500000 -0.000003
-4999.000000 -0.000016
-4998.500000 -0.000033

 

I want to replace a column of data and save it as another txt file (there is a space between two columns of number)

from

0.000042
-0.000003
-0.000016
-0.000033

 

into 

0.000050
-0.000008
-0.000018
-0.000039

 

Is there any way that the Labview program can read this file and transform it as another one with the same format?

Thank you.

0 Kudos
Message 1 of 5
(2,707 Views)

Your description is a tad confusing.  Can LV manipulate your data?  Yes.  But, what exactly are you trying to do?  You ask about replacing a column with headers (why wouldn't you just add headers and maintain the data?)  You also ask about swapping out a set of values.

 

Can you provide two examples of what you'd want your data to look like; one from before and one from after?  Not just a single column, but the entire data set?  If so, it'll be much easier to point you in a good direction.

Message 2 of 5
(2,669 Views)
Solution
Accepted by jimchu10

This can be achieve using string and array functions:

swap columns.pngHere the data is treated as dbl but string type can also be used. The rest of what you want to do is basic File I/O.

 

Ben64

Message 3 of 5
(2,650 Views)

Thank you!

 

The two examples are shown as below:

 

Before (in text file):

Date:
Sun, Mar 12, 2017
Time:
9:56 PM
Delta t (us)
499.999999E-3
Temperature (K):
300
Reactor Pressure (torr):
9.990000E+0

Time (microseconds) #$ Data
-5000.000000 0.000042
-4999.500000 -0.000003
-4999.000000 -0.000016
-4998.500000 -0.000033

 

After (save as another text file):

Date:
Sun, Mar 12, 2017
Time:
9:56 PM
Delta t (us)
499.999999E-3
Temperature (K):
300
Reactor Pressure (torr):
9.990000E+0

Time (microseconds) #$ Data
-5000.000000 0.000050
-4999.500000 -0.000008
-4999.000000 -0.000018
-4998.500000 -0.000039

0 Kudos
Message 4 of 5
(2,638 Views)

Thank you for providing the solution. I will give it a try and respond you after testing.

0 Kudos
Message 5 of 5
(2,637 Views)