08-06-2013 11:58 PM
I am using read text file line by line
if i have 22 lines means, it counting as 23 .. i m facing problem here
please help me
Solved! Go to Solution.
08-07-2013 12:19 AM
First, Insert into Array is the wrong function to use. You should be using Build Array.
You get an extra line because when you get an error that stops the while loop (and I'm guessing that is probably an End of File Error), you wind up passing an empty string from the Read function to the array building case structure. That becomes an empty string element at the end of the array.
You should only build the data onto the end of the array when there is no error.
08-07-2013 12:33 AM
You can completely remove the While loop, just by wiring -1 to the count terminal of Read from Text File function.
And you can remove following While loop.
08-07-2013 12:34 AM
yes , exactly, while getting empty error. it getting count of one line
but i couldnt get u, wat is ur suggestion..
kindly brief it please
thanks ..
08-07-2013 12:37 AM
But i have multiple files , without while loop , how would i read all the text files 😞
08-07-2013 12:41 AM - edited 08-07-2013 12:43 AM
So you need a loop (I'll prefer For loop), to read all files (1 by 1) and Read from Text File function placed in the loop, reading all the lines in each file in one go... So suppose you've 10 files to be read, For loop will execute 10 times and so will Read from Text File function.
Edited: added, It seems you already have a For loop (the outer most)... I was mentioning that you can remove the While loop (inner loop shown in your picture, also I had encircled it in Red)... For loop will still gonna be stay there.
08-07-2013 01:13 AM
Why do you have a case structure with a 1 constant wired into it?
Get rid of the constant and wire your error wire into the selector. The build array function would be in the "No Error" case.
Of course this doesn't handle your multiple file question. Moderator provided information to help you figure that out.
I'm only trying to help you figure out why your current code isn't working like you expected. I'm not going to try to read your mind and figure out everything it is you are trying to do.
08-07-2013 07:10 AM
This thread seems so familiar. We actually told you all of this in your other thread:http://forums.ni.com/t5/LabVIEW/I-want-handle-single-array-for-multiple-files/m-p/2513678