LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to read and extract only the newest lines out of a csv file

Hi,

 

We have a production instrument that saves data 24/7. Each data set is around 50 lines. I'm trying to extract only the newest lines that added to the file and save the data as another file, which should be overwritten by the next new dataset. How am I supposed to do this?

 

Thanks a lot,

0 Kudos
Message 1 of 3
(2,604 Views)

There are many things that need to be considered.

  • How often are data written to the file?
  • Is the file always open, with data being appended?  If so, how do you handle the program crashing?  [I'm assuming the program does an Open, Append, Close cycle].
  • You describe the file as a CSV file.  Is it really a human-readable text file, broken up into lines of text?
  • How many lines (from the end of the file, I presume) do you want to get?
  • What (specifically) do you want to do with these lines?  What sort of file-naming convention do you want to use?
  • Is the CSV file being written by LabVIEW?  [If not, why use LabVIEW to do the file extraction?]

Bob Schor

0 Kudos
Message 2 of 3
(2,587 Views)

Consider not saving data so often if you are just going to throw out the vast majority of it.

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 3
(2,577 Views)