From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This example opens a text file and counts the number of lines, separates the lines into a String array, and then returns the last line in a separate indicator.
Description
When retrieving data from a file, we often need it in array form. This VI takes a .txt file and converts it to an array of strings using "Spreadsheet String to Array". As a bonus, this VI also returns both the number of lines in the .txt file and the last line in the .txt file.
Requirements: LabVIEW 2012 (or compatible). Hardware: none.
Steps to Implement or Execute Code:
Additional Information or References:
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
does what requested, but it's not really smart to read the whole file. Better: Use set file and count backwards, until a line feed comes.
I don't understand why you are reading the file twice. Why not just read the file by lines (like you second read, use -1 as the count), get the array size from that, index out the last line?
Hi Crashingsux,
can you please upload a quick example of what you mentioned, how to count backwards until you find an "x" character from the end of a text file.
thanks.
Hi LaRisa_M, could you please upload the example for LV 2011 V11, both files are telling me they're V12 when oppening them on LV 2011.
thanks.