02-11-2010 12:14 PM
Hi,
I am trying to read data from serial port and write it on to a .txt file. I am able to write onto the file but it has got no formatting. What I would ideally like to do is, read the data from serial port, take only some parts of it and write on to the text file with proper formatting. Also, I would like to use the same file to append data each time. I am also having issues setting the pointer to EOF. I would like to append to end of file.
This is my sample data
18:33:23 02/10/10 28.32 0 LAC 0.378 mg/dL 0000\
18:33:23 02/10/10 28.32 0 GLU 102 mg/dL 0000
that is being read from the serial port. From this I would like to take only columns 1,2,3,5,6 and write onto the .txt file.
Can someone provide some pointers? I'm using Labview 6.1
Thanks,
Sukanya
02-11-2010 12:40 PM
I found out the reason for the loss of formatting in the .txt file. The actual data has some spaces and other things appended at the beginning. It's something like this "\s\s\s\02\n\s\s\s\88" but it appears as space and some random characters. Is there a way to remove these things before writing onto file?
02-11-2010 01:24 PM
02-11-2010 01:32 PM
You can read in the string, and break it into individual elements by either whitespace or tabs.
Then when you get to a carriage return, you know the line is done.
By breaking the string up into elements, you can build an array with only the columns you want.
Then you can write the columns to a text file using "write array to spreadsheet file"
02-11-2010 02:05 PM