From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

getting last 8640 lines from text file

I need to convert a text file into an array. it is a comma delimited text file. I have done this by using the read file.vi and then the spreadsheet string to array vi. the read file.vi needs an offset from the end in characters. the problem is that some of the lines have values which have more decimal places than the others since the values change. (so the character offset will be impossible to pin down. how do i get the last 8640 lines of the text file. once i do that i can convert them into the array and everything will be great.
0 Kudos
Message 1 of 2
(2,242 Views)
The simplest (but not necessarily the fastest) way I can think of is to open your entire file, convert it to array, and then take the last 8640 lines of your array using the "array subset" function.
Depending on the speed required for your application this might not be the most efficient way as large files (done multiple times) will slow your system.

Unfortunately, I dont think you can use the "Get lines from file.vi" to specify the number of lines and line offset to obtain your last 8640 lines.
0 Kudos
Message 2 of 2
(2,242 Views)