11-16-2011 03:00 PM
Hello all,
I created a lab view prog which I use for my expement. In every 3-4 minutes it creates me a .dat file which containes some headers and then some columns. I specified a place so all my dat files are saved in the same place.... Here is an example .dat file....
I have aout 4-5 thousand of these. What I want is another program which will let me open a .dat file, and choose specific columns or info and then write these in another .dat file and save in another place....
WOuld something like that be possible?
What_I_get.dat is the original file I get from my experiment.
What_I_want.dat is the way I want it to look after making changes.....
Thank you for your help./
11-16-2011 03:01 PM
sorry I couldnt attach my files with.dat extension so I attached their pictures.....
thanks again!
11-16-2011 03:03 PM
Sure it's possible. Just write a VI that reads one text file line by line, parses the data as necessary, and writes it out to another text file.
11-16-2011 03:07 PM
thanks for quick reply.
my problem is how do I write that file? is there a link that you can refer me to please?
11-16-2011 03:27 PM
With the functions in the File I/O palette.
11-16-2011 04:08 PM
this might sound like a very stupid question:
so once i put a read text file and specified a path for it, how do I tell it to choose specific lines?
11-16-2011 04:33 PM
You don't tell it to read specific lines. You pick out specific columns. Based on your input file one simple way to do this is to use the Read From Spreadsheet File VI to read in your source files. Read the files as string rather than numeric. Chop off the first 15 or 16 lines (up to the start of tabular data) and convert the rest using the Numeric -> String functions to get a 2D array of numbers. You can display the resultant 2D array on the front panel and provide controls (e.g., an array of Booleans) to select which columns to keep. The lines you chopped off at the beginning can be reconstituted into your new header (a 1D array of strings, where each element is a line of your header). You can then use the Write to Spreadsheet File VI to write out your header (feed it the 1D array of strings which are your header lines), and then the new 2D array that constists of only the columns you want.