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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing to file creates blank lines

Solved!
Go to solution

Hello,

 

I am writing a VI that reads the number of lines in a document. I turn the spreadsheet into an array, use the insert into array function to input a piece of data into it at a specified location, and then rewrite to the same file with the new array with the appended information.

 

Every time I run the vi, a blank line is also being written that is messing up my counter. Is there an easy fix to this?

 

Thanks,

notAWizard

0 Kudos
Message 1 of 6
(2,770 Views)

 Is there an easy fix to this?

 


Probably, if we could see your code. Sounds like the array is picking up an extra line at the EOF, but without seeing the code, I can only guess at the solution.

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 2 of 6
(2,760 Views)
Solution
Accepted by topic author notAWizard0555

If you are using 'Array to Spreadsheet String', it always appends an End of Line (\r\n) at the end, so you may want to remove those from the string (maybe Trim Whitespace) before writing to your file.

Message 3 of 6
(2,748 Views)

Since I cannot see the actual code, I can only guess for a 'possible' solution.

Use 'Trim Whitespace.vi' before writing your array with appended data back into the file.

Hope it helps.

0 Kudos
Message 4 of 6
(2,731 Views)

notAWizard,

 

     To become more "wizardly", attach your (failing) VI.  We can examine it, test it, be sure we understand what you are doing, fix it, and explain why it isn't working.  As you can see, there have been multiple "good guesses" as to the cause of your problem, but they might all be wrong, and this would be a waste of your time (reading and testing them) and our time.

 

     Posting your code saves time (and effort) for all of us.

 

Bob Schor

 

0 Kudos
Message 5 of 6
(2,701 Views)

Thanks to everyone who replied to my very vague question. Had to be vague due to company privacy policies, including not being able to post the vi.

 

You're awesome

0 Kudos
Message 6 of 6
(2,683 Views)