04-19-2010 09:43 PM
Using LabVIEW 2009 on Windows XP.
Looked through some of the postings...found a few clues, but thought I'd post anyway.
I'd like to ignore the blank lines in a text file that I'm reading.
Reading the text file line by line and passing it to a for loop with auto indexing enabled.
For loop increments...even when the line being passed is blank.
I'd like to filter these blank lines before they ever reach the for loop.
Thanks for tips/suggestions.
04-19-2010 10:05 PM
Disable auto-indexing. Maintain your own shift register for the array. Build a new row onto the array if it is not blank, just pass the array through if it is blank.
04-20-2010 01:28 PM
04-20-2010 02:54 PM
I am usually in a Search and Replace kind of mood. I'd look for multiple newline characters '\n' and replace them with a single one. In case you were reinventing the wheel in your For Loop, I threw in a Spreadsheet String to Array Function. Otherwise, I show you how to pass a clean string into a For Loop and pick out the lines.
04-20-2010 11:39 PM
Hi Darin,
I like your method of removing the blank lines, very simple. Your posted snippet has 1 slight problem that i noticed when running. The for loop counter needs to have a +1 added otherwise it misses the last line.
I modified your above vi slightly to just use the spreadsheet to array vi to build the array:
I think the combination is a neat solution.
Rgs,
Lucither
04-21-2010 03:43 AM
just don't forget do check for \r in some files...
it may be safer (it will take longer) to search and replace multiple:
\r
\n
\r\n
![]()