LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ignore Information at Beginning and end of data file

I have several thousand data files, each of which contains around 14-16 lines of information such as sampling frequency/channel information at the top, followed by the data in CSV format and ending off with another couple of lines of information. How would I go about filtering out the unwanted information so that just the raw data is left?
0 Kudos
Message 1 of 8
(3,239 Views)
If the headers are fixed # of lines, just use "Read Lines From Files.vi" to read in that many lines, then you will get an offset, start retrieving the data at the offset to the end.

If there is a distinguishable phrase or character before / after the csv data, then read in several lines at a time (if the file is small, read the whole file in one pass), search for the start and stop character(s), using the offset you obtained you can "subset" the data string, and use "String to spreasheet array.vi" to convert the csv data. Or you can use the "Read From spreadsheet File.vi" to get the data.

Joe
Message 2 of 8
(3,239 Views)
Thanks for the quick reply. I'd have to use the second option, as the number of lines isn't fixed but there are distinguishable characters before and after the file. I'm a complete beginner at this, so you'll have to excuse my ignorance, but if you could give me a bit of guidance as to how to search for the characters and subset the data (as in which vi's I should be using and what input parameters are required), that would be a real help. The last line of unwanted information reads "Data:" and the end of the data is signified by "Amin".

At the moment, I'm just using the 'Read From Spreadsheet File.vi" to read the whole file with csv set as the delimiter. Thanks a lot in advance!
0 Kudos
Message 3 of 8
(3,239 Views)
see the attached file

joe
0 Kudos
Message 4 of 8
(3,239 Views)
Sorry, should have mentioned that I've only got LabView 6.0 so can't read that - don't know if theres a good way around it, but a screenshot of the diagram would do if possible. Thanks very much for your time, it is very greatly appreciated.
0 Kudos
Message 5 of 8
(3,239 Views)
see the image

Joe
0 Kudos
Message 6 of 8
(3,239 Views)
Thanks, worked a treat!
0 Kudos
Message 7 of 8
(3,239 Views)
Hi Walderr:

You might want to consider that the header information might be useful, as well. Using the same technique as above, you can "pipe" the header lines to actual header locations in your data file. (Usually they don't represent a large use of memory, so it might be nice to preserve them....the voice of experience here!)

Just a thought

Eric
Eric P. Nichols
P.O. Box 56235
North Pole, AK 99705
0 Kudos
Message 8 of 8
(3,239 Views)